Skip to content

Commit cdf78ab

Browse files
committed
Merge branch 'develop' into 4.6
2 parents 857673b + 700ba29 commit cdf78ab

File tree

7 files changed

+24
-26
lines changed

7 files changed

+24
-26
lines changed

phpstan-baseline.php

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15169,12 +15169,6 @@
1516915169
'count' => 1,
1517015170
'path' => __DIR__ . '/tests/system/HomeTest.php',
1517115171
];
15172-
$ignoreErrors[] = [
15173-
// identifier: codeigniter.superglobalAccessAssign
15174-
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
15175-
'count' => 1,
15176-
'path' => __DIR__ . '/tests/system/HomeTest.php',
15177-
];
1517815172
$ignoreErrors[] = [
1517915173
// identifier: empty.notAllowed
1518015174
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
@@ -15507,13 +15501,13 @@
1550715501
];
1550815502
$ignoreErrors[] = [
1550915503
// identifier: argument.type
15510-
'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\\.$#',
15504+
'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\\.$#',
1551115505
'count' => 1,
1551215506
'path' => __DIR__ . '/tests/system/Models/DataConverterModelTest.php',
1551315507
];
1551415508
$ignoreErrors[] = [
1551515509
// identifier: argument.type
15516-
'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\\.$#',
15510+
'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\\.$#',
1551715511
'count' => 1,
1551815512
'path' => __DIR__ . '/tests/system/Models/DataConverterModelTest.php',
1551915513
];
@@ -15903,7 +15897,7 @@
1590315897
];
1590415898
$ignoreErrors[] = [
1590515899
// identifier: argument.type
15906-
'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\\.$#',
15900+
'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\\.$#',
1590715901
'count' => 1,
1590815902
'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php',
1590915903
];
@@ -16963,12 +16957,6 @@
1696316957
'count' => 1,
1696416958
'path' => __DIR__ . '/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php',
1696516959
];
16966-
$ignoreErrors[] = [
16967-
// identifier: codeigniter.superglobalAccessAssign
16968-
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
16969-
'count' => 1,
16970-
'path' => __DIR__ . '/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php',
16971-
];
1697216960
$ignoreErrors[] = [
1697316961
// identifier: empty.notAllowed
1697416962
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
@@ -17077,12 +17065,6 @@
1707717065
'count' => 1,
1707817066
'path' => __DIR__ . '/tests/system/Test/FeatureTestTraitTest.php',
1707917067
];
17080-
$ignoreErrors[] = [
17081-
// identifier: codeigniter.superglobalAccessAssign
17082-
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
17083-
'count' => 1,
17084-
'path' => __DIR__ . '/tests/system/Test/FeatureTestTraitTest.php',
17085-
];
1708617068
$ignoreErrors[] = [
1708717069
// identifier: empty.notAllowed
1708817070
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',

system/HTTP/CURLRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public function send(string $method, string $url)
389389
$output = substr($output, strpos($output, $breakString) + 4);
390390
}
391391

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

system/HTTP/ResponseInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function setContentType(string $mime, string $charset = 'UTF-8');
200200
/**
201201
* Converts the $body into JSON and sets the Content Type header.
202202
*
203-
* @param array|string $body
203+
* @param array|object|string $body
204204
*
205205
* @return $this
206206
*/

system/Test/FeatureTestTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ public function call(string $method, string $path, ?array $params = null)
179179
$method = strtoupper($method);
180180

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

185185
$request = $this->setupRequest($method, $path);
186186
$request = $this->setupHeaders($request);

tests/system/HTTP/CURLRequestTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,21 @@ public function testSendProxied(): void
831831
$this->assertSame('Hi there', $response->getBody());
832832
}
833833

834+
public function testSendProxiedWithHTTP10(): void
835+
{
836+
$request = $this->getRequest([
837+
'base_uri' => 'http://www.foo.com/api/v1/',
838+
'delay' => 100,
839+
]);
840+
841+
$output = "HTTP/1.0 200 Connection established
842+
Proxy-Agent: Fortinet-Proxy/1.0\x0d\x0a\x0d\x0aHTTP/1.1 200 OK\x0d\x0a\x0d\x0aHi there";
843+
$request->setOutput($output);
844+
845+
$response = $request->get('answer');
846+
$this->assertSame('Hi there', $response->getBody());
847+
}
848+
834849
/**
835850
* See: https://github.com/codeigniter4/CodeIgniter4/issues/7394
836851
*/

tests/system/Helpers/ArrayHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function testArraySortByMultipleKeysWithObjects(array $data, array $sortC
268268
$success = array_sort_by_multiple_keys($data, $sortColumns);
269269

270270
$this->assertTrue($success);
271-
$this->assertSame($expected, array_column((array) $data, 'name'));
271+
$this->assertSame($expected, array_column($data, 'name'));
272272
}
273273

274274
#[DataProvider('provideSortByMultipleKeys')]

user_guide_src/source/changelogs/v4.5.6.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Bugs Fixed
4040
- **Routing:** Fixed a TypeError in `str_replace()` when `Routing::$translateURIDashes` is set to `true` and a route is defined using a closure.
4141

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

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

0 commit comments

Comments
 (0)