[php-src] PR #24503: Add gd.png_ignore_warning INI setting
| From: | cgsmith | Date: | Wed, 21 Oct 2026 20:11:59 +0000 |
| Subject: | [php-src] PR #24503: Add gd.png_ignore_warning INI setting | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39675@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24503
Author: cgsmith
Closes GH-23674.
Adds a
gd.png_ignore_warning INI setting, following the design @devnexen suggested in
the issue and mirroring gd.jpeg_ignore_warning.
PNGs with an invalid iCCP chunk (e.g. Photoshop exports with a "known incorrect sRGB
profile") currently emit an E_WARNING on every load, and the only way to hide it is
@, which also hides real failures.
- Off by default, so existing behaviour is unchanged.
- When enabled, gdPngWarningHandler() drops recoverable libpng warnings.
- gdPngErrorHandler() is untouched, so fatal errors are still reported.
- Applies to imagecreatefrompng() and imagecreatefromstring().
- The flag is passed via new
gdImageCreateFromPngEx()/gdImageCreateFromPngCtxEx() in the bundled libgd;
the existing functions forward to them with the flag off.
Open questions:
- With an external libgd the setting is registered but has no effect. Happy to register it only for
bundled builds instead.
- Should the Ex functions also be proposed upstream to libgd?
Tests: ext/gd/tests/gh23674.phpt with a small PNG fixture containing a malformed iCCP
chunk. The full gd suite passes locally (macOS, bundled libgd, both non-ZTS and ZTS debug builds).
Thanks to @adrian-schenk, who also offered to look into this on the issue.