mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Merge branch 'PHP-5.6' into PHP-7.0
This commit is contained in:
commit
8cc9570f53
4
NEWS
4
NEWS
@ -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)
|
||||
|
||||
|
@ -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
BIN
ext/gd/tests/bug67325.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
29
ext/gd/tests/bug67325.phpt
Normal file
29
ext/gd/tests/bug67325.phpt
Normal 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===
|
Loading…
Reference in New Issue
Block a user