php-src/ext/gd/tests/bug73159.phpt
Christoph M. Becker 709731797c Fix #73159: imagegd2(): unrecognized formats may result in corrupted files
We must not apply the format correction twice for truecolor images.
2016-09-24 11:28:20 +02:00

22 lines
425 B
PHP

--TEST--
Bug #73159 (imagegd2(): unrecognized formats may result in corrupted files)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$im = imagecreatetruecolor(10, 10);
ob_start();
imagegd2($im, null, 128, 0);
$buffer = ob_get_clean();
$header = unpack('@12/nformat', $buffer);
printf("format: %d\n", $header['format']);
?>
===DONE===
--EXPECT--
format: 4
===DONE===