1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 06:51:18 +02:00
Files
archived-php-src/ext/gd/tests/bug66590.phpt
Christoph M. Becker a375d54785 Migrate skip checks to --EXTENSIONS-- for ext/gd
Cf. PR #6787.

Closes GH-6994.
2021-05-22 15:38:51 +02:00

32 lines
775 B
PHP

--TEST--
Bug #66590 (imagewebp() doesn't pad to even length)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
die("skip test requires GD 2.2.0 or higher");
}
if (!function_exists('imagewebp')) die('skip WebP support not available');
?>
--FILE--
<?php
$filename = __DIR__ . '/bug66590.webp';
$im = imagecreatetruecolor(75, 75);
$red = imagecolorallocate($im, 255, 0, 0);
imagefilledrectangle($im, 0, 0, 74, 74, $red);
imagewebp($im, $filename);
$stream = fopen($filename, 'rb');
fread($stream, 4); // skip "RIFF"
$length = fread($stream, 4);
fclose($stream);
$length = unpack('V', $length)[1] + 8;
var_dump($length === filesize($filename));
?>
--CLEAN--
<?php
@unlink(__DIR__ . '/bug66590.webp');
?>
--EXPECT--
bool(true)