Skip to content

Commit 123e2ac

Browse files
Markus Fruehaufondrejmirtes
authored andcommitted
getimagesize, getimagesizefromstring zero is a possible value for height and width
1 parent e685c40 commit 123e2ac

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

resources/functionMap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3331,8 +3331,8 @@
33313331
'gethostbyname' => ['string', 'hostname'=>'string'],
33323332
'gethostbynamel' => ['list<string>|false', 'hostname'=>'string'],
33333333
'gethostname' => ['string|false'],
3334-
'getimagesize' => ['array{0: positive-int, 1: positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'imagefile'=>'string', '&w_info='=>'array'],
3335-
'getimagesizefromstring' => ['array{0: positive-int, 1: positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'data'=>'string', '&w_info='=>'array'],
3334+
'getimagesize' => ['array{0: 0|positive-int, 1: 0|positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'imagefile'=>'string', '&w_info='=>'array'],
3335+
'getimagesizefromstring' => ['array{0: 0|positive-int, 1: 0|positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'data'=>'string', '&w_info='=>'array'],
33363336
'getlastmod' => ['int|false'],
33373337
'getmxrr' => ['bool', 'hostname'=>'string', '&w_mxhosts'=>'array', '&w_weight='=>'array'],
33383338
'getmygid' => ['int|false'],

tests/PHPStan/Analyser/nsrt/image-size.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function imageFoo(): void
1414

1515
list($width, $height, $type, $attr) = $imagesize;
1616

17-
assertType('int<1, max>', $width);
18-
assertType('int<1, max>', $height);
17+
assertType('int<0, max>', $width);
18+
assertType('int<0, max>', $height);
1919
assertType('int', $type);
2020
assertType('string', $attr);
2121
assertType('string', $imagesize['mime']);
@@ -31,8 +31,8 @@ function imagesizeFoo(string $s): void
3131
}
3232
list($width, $height, $type, $attr) = $imagesize;
3333

34-
assertType('int<1, max>', $width);
35-
assertType('int<1, max>', $height);
34+
assertType('int<0, max>', $width);
35+
assertType('int<0, max>', $height);
3636
assertType('int', $type);
3737
assertType('string', $attr);
3838
assertType('string', $imagesize['mime']);

0 commit comments

Comments
 (0)