1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Add test case for GH-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.

Closes GH-14945.
This commit is contained in:
Christoph M. Becker
2024-07-13 19:19:44 +02:00
parent b456ae8d34
commit 6d0db52896

25
ext/gd/tests/gh13774.phpt Normal file
View File

@@ -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)