1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/ext/gd/tests/bug79615.phpt
Christoph M. Becker d4bd6fb491 Fix #79615: Wrong GIF header written in GD GIFEncode
The color resolution is expected in bits 4-6 of the packed fields byte
of the logical screen descriptor (byte 10 of the GIF data stream),
according to the specification[1], section 18.

[1] <https://www.w3.org/Graphics/GIF/spec-gif89a.txt>
2020-05-22 09:15:41 +02:00

21 lines
458 B
PHP

--TEST--
Bug #79615 (Wrong GIF header written in GD GIFEncode)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$im = imagecreate(3, 3); // 3x3, 9 colors, 4 bits per pixel
for ($x = 0; $x < 3; $x++) {
for ($y = 0; $y < 3; $y++) {
imagesetpixel($im, $x, $y, imagecolorallocate($im, $x, $y, 0));
}
}
ob_start();
imagegif($im);
echo decbin(ord(ob_get_clean()[0xA]));
?>
--EXPECT--
10110011