1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

* PHP-8.4:
  Add support for reading GIFs without colormap
This commit is contained in:
Christoph M. Becker
2025-01-09 12:07:03 +01:00
3 changed files with 15 additions and 2 deletions

View File

@@ -244,8 +244,10 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
BitSet(buf[8], INTERLACE), &ZeroDataBlock);
} else {
if (!haveGlobalColormap) {
gdImageDestroy(im);
return 0;
// Still a valid gif, apply simple default palette as per spec
ColorMap[CM_RED][1] = 0xff;
ColorMap[CM_GREEN][1] = 0xff;
ColorMap[CM_BLUE][1] = 0xff;
}
ReadImage(im, fd, width, height,
ColorMap,

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 B

View File

@@ -0,0 +1,11 @@
--TEST--
A GIF without any Global or Local color tables is still decoded
--EXTENSIONS--
gd
--FILE--
<?php
$im = imagecreatefromgif(__DIR__ . "/gif_nocolormaps.gif");
var_dump($im instanceof GdImage);
?>
--EXPECT--
bool(true)