Skip to content

Commit f2e374c

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

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

ext/standard/image.c

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

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

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)