Skip to content

Commit 15ad0a3

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 8b0752a + 67436e3 commit 15ad0a3

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

system/HTTP/Response.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public function __construct($config) // @phpstan-ignore-line
178178
*
179179
* @return $this
180180
*
181+
* @internal For testing purposes only.
181182
* @testTag only available to test code
182183
*/
183184
public function pretend(bool $pretend = true)

system/Validation/FileRules.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,13 @@ public function max_dims(?string $blank, string $params): bool
244244
$allowedHeight = $params[1] ?? 0;
245245

246246
// Get uploaded image size
247-
$info = getimagesize($file->getTempName());
247+
$info = getimagesize($file->getTempName());
248+
249+
if ($info === false) {
250+
// Cannot get the image size.
251+
return false;
252+
}
253+
248254
$fileWidth = $info[0];
249255
$fileHeight = $info[1];
250256

tests/system/Test/TestCaseTest.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
use CodeIgniter\CLI\CLI;
1717
use CodeIgniter\Events\Events;
18-
use CodeIgniter\HTTP\Response;
19-
use Config\App;
2018
use Tests\Support\Test\TestForReflectionHelper;
2119

2220
/**
@@ -76,31 +74,6 @@ public function testStreamFilter(): void
7674
$this->assertSame($expected, $this->getStreamFilterBuffer());
7775
}
7876

79-
/**
80-
* PHPunit emits headers before we get nominal control of
81-
* the output stream, making header testing awkward, to say
82-
* the least. This test is intended to make sure that this
83-
* is happening as expected.
84-
*
85-
* TestCaseEmissionsTest is intended to circumvent PHPunit,
86-
* and allow us to test our own header emissions.
87-
*/
88-
public function testPHPUnitHeadersEmitted(): void
89-
{
90-
$response = new Response(new App());
91-
$response->pretend(true);
92-
93-
$body = 'Hello';
94-
$response->setBody($body);
95-
96-
ob_start();
97-
$response->send();
98-
ob_end_clean();
99-
100-
$this->assertHeaderEmitted('Content-type: text/html;');
101-
$this->assertHeaderNotEmitted('Set-Cookie: foo=bar;');
102-
}
103-
10477
public function testCloseEnough(): void
10578
{
10679
$this->assertCloseEnough(1, 1);

0 commit comments

Comments
 (0)