Skip to content

Commit 130e931

Browse files
committed
refactor(HTTP): remove default parameter in IncomingRequest::getPostMaxSize()
1 parent 6419f60 commit 130e931

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

‎system/HTTP/IncomingRequest.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function __construct($config, ?URI $uri = null, $body = 'php://input', ?U
140140
// php://input is not available with enctype="multipart/form-data".
141141
// See https://www.php.net/manual/en/wrappers.php.php#wrappers.php.input
142142
&& ! str_contains($this->getHeaderLine('Content-Type'), 'multipart/form-data')
143-
&& (int) $this->getHeaderLine('Content-Length') <= $this->getPostMaxSize()
143+
&& (int) $this->getHeaderLine('Content-Length') <= $this->getPostMaxSize((string) ini_get('post_max_size'))
144144
) {
145145
// Get our body from php://input
146146
$body = file_get_contents('php://input');
@@ -172,9 +172,9 @@ public function __construct($config, ?URI $uri = null, $body = 'php://input', ?U
172172
*
173173
* A value of 0 or less means unlimited.
174174
*/
175-
private function getPostMaxSize(?string $postMaxSize = null): int
175+
private function getPostMaxSize(string $postMaxSize): int
176176
{
177-
$bytes = ini_parse_quantity($postMaxSize ?? (string) ini_get('post_max_size'));
177+
$bytes = ini_parse_quantity($postMaxSize);
178178

179179
return $bytes <= 0 ? PHP_INT_MAX : $bytes;
180180
}

‎tests/system/HTTP/IncomingRequestTest.php‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,16 +1121,6 @@ public static function provideGetPostMaxSize(): iterable
11211121
yield 'bytes' => ['12345', 12345];
11221122
}
11231123

1124-
public function testGetPostMaxSizeDefault(): void
1125-
{
1126-
$getPostMaxSize = $this->getPrivateMethodInvoker($this->request, 'getPostMaxSize');
1127-
1128-
$bytes = ini_parse_quantity((string) ini_get('post_max_size'));
1129-
$expected = $bytes <= 0 ? PHP_INT_MAX : $bytes;
1130-
1131-
$this->assertSame($expected, $getPostMaxSize());
1132-
}
1133-
11341124
public function testGetIPAddressNormal(): void
11351125
{
11361126
$expected = '123.123.123.123';

0 commit comments

Comments
 (0)