[go: nahoru, domu]

Skip to content

Commit

Permalink
Add test case for GH-13774
Browse files Browse the repository at this point in the history
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.

Closes GH-14945.
  • Loading branch information
cmb69 committed Jul 14, 2024
1 parent b456ae8 commit 6d0db52
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ext/gd/tests/gh13774.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
GH-13774 (Restore Warning instead of Fatal Error in gd_webp.c)
--EXTENSIONS--
gd
--SKIPIF--
<?php
$support = gd_info();
if (!isset($support['WebP Support']) || $support['WebP Support'] === false) {
print 'skip webp support not available';
}
?>
--FILE--
<?php
$empty_webp = __DIR__ . "/gh13774.webp";
file_put_contents($empty_webp, "");
$im = imagecreatefromwebp($empty_webp);
var_dump($im);
?>
--CLEAN--
<?php unlink(__DIR__ . "/gh13774.webp")?>
--EXPECTF--
Warning: imagecreatefromwebp(): gd-webp cannot get webp info in %s on line %d

Warning: imagecreatefromwebp(): "%s" is not a valid WEBP file in %s on line %d
bool(false)

0 comments on commit 6d0db52

Please sign in to comment.