Merge branch 'PHP-5.6' into PHP-7.0

This commit is contained in:
Christoph M. Becker 2016-09-03 19:52:19 +02:00
commit 8cc9570f53
4 changed files with 34 additions and 1 deletions

4
NEWS
View File

@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2016 PHP 7.0.12
- GD:
. Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).
(cmb)
- mbstring:
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)

View File

@ -760,7 +760,7 @@ LOCAL (void)
cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total >> 1)) / total);
#else
/* 2.0.16: Paul den Dulk found an occasion where total can be 0 */
if (count)
if (total)
{
nim->red[icolor] = (int) ((c0total + (total >> 1)) / total);
nim->green[icolor] = (int) ((c1total + (total >> 1)) / total);

BIN
ext/gd/tests/bug67325.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,29 @@
--TEST--
Bug #67325 (imagetruecolortopalette: white is duplicated in palette)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (!(imagetypes() & IMG_JPG)) die('skip JPEG support not available');
?>
--FILE--
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug67325.jpeg';
$im = imagecreatefromjpeg($filename);
imagetruecolortopalette($im, 0, 256);
$white = 0;
for ($i = 0; $i < 256; $i++) {
$components = imagecolorsforindex($im, $i);
if ($components['red'] === 255 && $components['green'] === 255 && $components['blue'] === 255) {
$white++;
}
}
var_dump($white);
imagedestroy($im);
?>
===DONE===
--EXPECT--
int(0)
===DONE===