Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.4
Browse files Browse the repository at this point in the history
 Conflicts:
	user_guide_src/source/database/configuration.rst
  • Loading branch information
kenjis committed Jun 29, 2023
2 parents b241ca8 + 46e1ab1 commit e3bc5e9
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ protected function transformDataToArray($data, string $type): array
*
* @param string $name Name
*
* @return mixed
* @return array|bool|float|int|object|string|null
*/
public function __get(string $name)
{
Expand Down
8 changes: 4 additions & 4 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ function app_timezone(): string
* cache()->save('foo', 'bar');
* $foo = cache('bar');
*
* @return CacheInterface|mixed
* @phpstan-return ($key is null ? CacheInterface : mixed)
* @return array|bool|CacheInterface|float|int|object|string|null
* @phpstan-return ($key is null ? CacheInterface : array|bool|float|int|object|string|null)
*/
function cache(?string $key = null)
{
Expand Down Expand Up @@ -1007,7 +1007,7 @@ function session(?string $val = null)
* - $timer = service('timer')
* - $timer = \CodeIgniter\Config\Services::timer();
*
* @param mixed ...$params
* @param array|bool|float|int|object|string|null ...$params
*
* @return object
*/
Expand All @@ -1021,7 +1021,7 @@ function service(string $name, ...$params)
/**
* Always returns a new instance of the class.
*
* @param mixed ...$params
* @param array|bool|float|int|object|string|null ...$params
*
* @return object|null
*/
Expand Down
4 changes: 4 additions & 0 deletions system/HTTP/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ public function send(string $method, string $url)
$output = substr($output, strpos($output, $breakString) + 4);
}

if (strpos($output, 'HTTP/1.1 200 Connection established') === 0) {
$output = substr($output, strpos($output, $breakString) + 4);
}

// If request and response have Digest
if (isset($this->config['auth'][2]) && $this->config['auth'][2] === 'digest' && strpos($output, 'WWW-Authenticate: Digest') !== false) {
$output = substr($output, strpos($output, $breakString) + 4);
Expand Down
4 changes: 2 additions & 2 deletions system/Helpers/number_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ function format_number(float $num, int $precision = 1, ?string $locale = null, a
/**
* Convert a number to a roman numeral.
*
* @param string $num it will convert to int
* @param int|string $num it will convert to int
*/
function number_to_roman(string $num): ?string
function number_to_roman($num): ?string
{
static $map = [
'M' => 1000,
Expand Down
4 changes: 2 additions & 2 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur
*
* @param string $name Name
*
* @return mixed
* @return array|BaseBuilder|bool|float|int|object|string|null
*/
public function __get(string $name)
{
Expand Down Expand Up @@ -821,7 +821,7 @@ public function __isset(string $name): bool
* Provides direct access to method in the builder (if available)
* and the database connection.
*
* @return mixed
* @return $this|array|BaseBuilder|bool|float|int|object|string|null
*/
public function __call(string $name, array $params)
{
Expand Down
15 changes: 15 additions & 0 deletions tests/system/HTTP/CURLRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,21 @@ public function testSendContinuedWithManyHeaders()
$this->assertSame(200, $response->getStatusCode());
}

public function testSendProxied()
{
$request = $this->getRequest([
'base_uri' => 'http://www.foo.com/api/v1/',
'delay' => 100,
]);

$output = "HTTP/1.1 200 Connection established
Proxy-Agent: Fortinet-Proxy/1.0\x0d\x0a\x0d\x0aHTTP/1.1 200 OK\x0d\x0a\x0d\x0aHi there";
$request->setOutput($output);

$response = $request->get('answer');
$this->assertSame('Hi there', $response->getBody());
}

/**
* See: https://github.com/codeigniter4/CodeIgniter4/issues/7394
*/
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/database/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Explanation of Values:
**compress** Whether or not to use client compression (``MySQLi`` only).
**strictOn** true/false (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL
while developing an application (``MySQLi`` only).
**port** The database port number.
**port** The database port number - Empty string ``''`` for default port (or dynamic port with ``SQLSRV``).
**foreignKeys** true/false (boolean) - Whether or not to enable Foreign Key constraint (``SQLite3`` only).

.. important:: SQLite3 Foreign Key constraint is disabled by default.
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/helpers/number_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The following functions are available:

.. php:function:: number_to_roman($num)
:param string $num: The number want to convert
:param int|string $num: The number want to convert
:returns: The roman number converted from given parameter
:rtype: string|null

Expand All @@ -101,4 +101,4 @@ The following functions are available:
.. literalinclude:: number_helper/009.php

This function only handles numbers in the range 1 through 3999.
It will return null for any value outside that range.
It will return ``null`` for any value outside that range.
4 changes: 2 additions & 2 deletions user_guide_src/source/helpers/number_helper/009.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

echo number_to_roman(23); // Returns XXIII
echo number_to_roman(324); // Returns CCCXXIV
echo number_to_roman(23); // Returns XXIII
echo number_to_roman(324); // Returns CCCXXIV
echo number_to_roman(2534); // Returns MMDXXXIV

0 comments on commit e3bc5e9

Please sign in to comment.