Skip to content

Commit 00c8cea

Browse files
committed
Add test case for phpGH-13774
Besides demonstrating the new behavior, this test also ensures that the bundled and external libgd now behave the same. It has to be noted, though, that we only test one of the five code paths.
1 parent b456ae8 commit 00c8cea

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

ext/gd/tests/gh13774.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
GH-13774 (Restore Warning instead of Fatal Error in gd_webp.c)
3+
--EXTENSIONS--
4+
gd
5+
--SKIPIF--
6+
<?php
7+
$support = gd_info();
8+
if (!isset($support['WebP Support']) || $support['WebP Support'] === false) {
9+
print 'skip webp support not available';
10+
}
11+
?>
12+
--FILE--
13+
<?php
14+
$empty_webp = __DIR__ . "/gh13774.webp";
15+
file_put_contents($empty_webp, "");
16+
$im = imagecreatefromwebp($empty_webp);
17+
var_dump($im);
18+
?>
19+
--CLEAN--
20+
<?php unlink(__DIR__ . "/gh13774.webp")?>
21+
--EXPECTF--
22+
Warning: imagecreatefromwebp(): gd-webp cannot get webp info in %s on line %d
23+
24+
Warning: imagecreatefromwebp(): "%s" is not a valid WEBP file in %s on line %d
25+
bool(false)

0 commit comments

Comments
 (0)