Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #79615: Wrong GIF header written in GD GIFEncode
This commit is contained in:
Christoph M. Becker 2020-05-22 09:18:42 +02:00
commit da801ba5e3
3 changed files with 24 additions and 1 deletions

3
NEWS
View file

@ -12,6 +12,9 @@ PHP NEWS
- FFI:
. Fixed bug #79571 (FFI: var_dumping unions may segfault). (cmb)
- GD:
. Fixed bug #79615 (Wrong GIF header written in GD GIFEncode). (sageptr, cmb)
- Opcache:
. Fixed bug #79588 (Boolean opcache settings ignore on/off values). (cmb)
. Fixed bug #79548 (Preloading segfault with inherited method using static

View file

@ -333,7 +333,7 @@ GIFEncode(gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background
/*
* OR in the resolution
*/
B |= (Resolution - 1) << 5;
B |= (Resolution - 1) << 4;
/*
* OR in the Bits per Pixel

View file

@ -0,0 +1,20 @@
--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