Skip to content

Commit

Permalink
Merge branch 'develop' into 4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Nov 30, 2024
2 parents 857673b + 700ba29 commit cdf78ab
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
24 changes: 3 additions & 21 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -15169,12 +15169,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/HomeTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.superglobalAccessAssign
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/HomeTest.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down Expand Up @@ -15507,13 +15501,13 @@
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array<int\\|string, bool\\|float\\|int\\|object\\|string\\|null>\\|object, array<string, array<int, string>> given\\.$#',
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array\\<int\\|string, bool\\|float\\|int\\|object\\|string\\|null\\>\\|object, array\\<string, array\\<int, string\\>\\> given\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/DataConverterModelTest.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\$row of method CodeIgniter\\\\Model\\:\\:update\\(\\) expects array<int\\|string, bool\\|float\\|int\\|object\\|string\\|null>\\|object\\|null, array<string, array<int, string>> given\\.$#',
'message' => '#^Parameter \\#2 \\$row of method CodeIgniter\\\\Model\\:\\:update\\(\\) expects array\\<int\\|string, bool\\|float\\|int\\|object\\|string\\|null\\>\\|object\\|null, array\\<string, array\\<int, string\\>\\> given\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/DataConverterModelTest.php',
];
Expand Down Expand Up @@ -15903,7 +15897,7 @@
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array<int\\|string, bool\\|float\\|int\\|object\\|string\\|null>\\|object, array<int, array>\\|null given\\.$#',
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array\\<int\\|string, bool\\|float\\|int\\|object\\|string\\|null\\>\\|object, array\\<int, array\\>\\|null given\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php',
];
Expand Down Expand Up @@ -16963,12 +16957,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.superglobalAccessAssign
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down Expand Up @@ -17077,12 +17065,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestTraitTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.superglobalAccessAssign
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestTraitTest.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function send(string $method, string $url)
$output = substr($output, strpos($output, $breakString) + 4);
}

if (str_starts_with($output, 'HTTP/1.1 200 Connection established')) {
if (preg_match('/HTTP\/\d\.\d 200 Connection established/i', $output)) {
$output = substr($output, strpos($output, $breakString) + 4);
}

Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/ResponseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function setContentType(string $mime, string $charset = 'UTF-8');
/**
* Converts the $body into JSON and sets the Content Type header.
*
* @param array|string $body
* @param array|object|string $body
*
* @return $this
*/
Expand Down
4 changes: 2 additions & 2 deletions system/Test/FeatureTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ public function call(string $method, string $path, ?array $params = null)
$method = strtoupper($method);

// Simulate having a blank session
$_SESSION = [];
$_SERVER['REQUEST_METHOD'] = $method;
$_SESSION = [];
service('superglobals')->setServer('REQUEST_METHOD', $method);

$request = $this->setupRequest($method, $path);
$request = $this->setupHeaders($request);
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 @@ -831,6 +831,21 @@ public function testSendProxied(): void
$this->assertSame('Hi there', $response->getBody());
}

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

$output = "HTTP/1.0 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 tests/system/Helpers/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function testArraySortByMultipleKeysWithObjects(array $data, array $sortC
$success = array_sort_by_multiple_keys($data, $sortColumns);

$this->assertTrue($success);
$this->assertSame($expected, array_column((array) $data, 'name'));
$this->assertSame($expected, array_column($data, 'name'));
}

#[DataProvider('provideSortByMultipleKeys')]
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.5.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Bugs Fixed
- **Routing:** Fixed a TypeError in `str_replace()` when `Routing::$translateURIDashes` is set to `true` and a route is defined using a closure.

- **Validation:** Fixed a bug where complex language strings were not properly handled.
- **CURLRequest:** Added support for handling proxy responses using HTTP versions other than 1.1.

See the repo's
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
Expand Down

0 comments on commit cdf78ab

Please sign in to comment.