Skip to content

Commit 12a858a

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix bug #81265: getimagesize returns 0 for 256px ICO images
2 parents bb4dbbc + 8f97f82 commit 12a858a

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PHP NEWS
1010

1111
- Standard:
1212
. Fixed bug #72146 (Integer overflow on substr_replace). (cmb)
13+
. Fixed bug #81265 (getimagesize returns 0 for 256px ICO images).
14+
(George Dietrich)
1315

1416
29 Jul 2021, PHP 8.0.9
1517

ext/standard/image.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,12 @@ static struct gfxinfo *php_handle_ico(php_stream * stream)
10981098
num_icons--;
10991099
}
11001100

1101+
if (0 == result->width)
1102+
result->width = 256;
1103+
1104+
if (0 == result->height)
1105+
result->height = 256;
1106+
11011107
return result;
11021108
}
11031109
/* }}} */

ext/standard/tests/image/32x256.ico

10.1 KB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
GetImageSize() for ico format with 256px height
3+
--FILE--
4+
<?php
5+
echo "*** Testing getimagesize() : 256px ico ***\n";
6+
var_dump(getimagesize(__DIR__ . "/32x256.ico"));
7+
8+
?>
9+
===DONE===
10+
--EXPECT--
11+
*** Testing getimagesize() : 256px ico ***
12+
array(6) {
13+
[0]=>
14+
int(32)
15+
[1]=>
16+
int(256)
17+
[2]=>
18+
int(17)
19+
[3]=>
20+
string(23) "width="32" height="256""
21+
["bits"]=>
22+
int(8)
23+
["mime"]=>
24+
string(24) "image/vnd.microsoft.icon"
25+
}
26+
===DONE===

0 commit comments

Comments
 (0)