Hi everybody!

During the discussion of PR 3080[1] the idea to replace our bundled
libgd with an (unmodified) upstream libgd[2] has come up again.  It
seems this issue deserves its own discussion, and probably an RFC.

Our bundled libgd (particularly as found in master) is mostly compatible
with upstream libgd 2.2.5 – actually, the API is compatible, but there
are several (mostly minor) implementation differences.  For instance,
the $threshold parameter of imagecropauto($im, IMG_CROP_THRESHOLD) is
interpreted differently[3], the result of imagettfbbox() is slightly
different[4] and imagetruecolortopalette() uses a completely different
algorithm if built with libimagequant (which is not available for the
bundled libgd)[5].  Another important difference is that our bundled
libgd uses ZendMM, but upstream libgd does not[6].

For most Linux environments PHP is built with an upstream (system)
libgd; on Windows usually the bundled libgd is used.  Users targeting
both platforms likely already have conditional code (using `GD_BUNDLED`)
to cater to relevant implementation differences.  So, assuming we would
not set `GD_BUNDLED` anymore after bundling upstream libgd, most users
would not notice a difference.  However, the PHP manual explicitly
recommends to use the bundled libgd[7], so users heeding this advice
would face several minor BC breaks.

The main benefit of bundling upstream libgd, though, would be to save
time by avoiding the 2-way synchronizations (which often occur on a per
commit basis, and may even sometimes be overlooked).

Any thoughts are welcome!

[1] <https://github.com/php/php-src/pull/3080>
[2] <http://libgd.github.io/>
[3] <https://bugs.php.net/73291>
[4] <https://github.com/php/php-src/pull/1845>
[5]
<http://libgd.github.io/manuals/2.2.5/files/gd-h.html#gdPaletteQuantizationMethod>
[6] <https://github.com/libgd/libgd/issues/335>
[7] <http://www.php.net/manual/en/image.installation.php>

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to