summaryrefslogtreecommitdiff
path: root/ext/gd/tests/bug66590.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/tests/bug66590.phpt')
-rw-r--r--ext/gd/tests/bug66590.phpt27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/gd/tests/bug66590.phpt b/ext/gd/tests/bug66590.phpt
new file mode 100644
index 0000000000..a3c5409d6b
--- /dev/null
+++ b/ext/gd/tests/bug66590.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #66590 (imagewebp() doesn't pad to even length)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+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)