Skip to content

ext/gd: Fix two external libgd tests - #23138

Merged
devnexen merged 2 commits into
php:masterfrom
lotharsm:fix-external-libgd-tests
Aug 9, 2026
Merged

ext/gd: Fix two external libgd tests#23138
devnexen merged 2 commits into
php:masterfrom
lotharsm:fix-external-libgd-tests

Conversation

@lotharsm

@lotharsm lotharsm commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

After intruducing

php-src/ext/gd/gd.c

Lines 302 to 306 in bf5141c

/* Keep PHP's historical PNG warning text while bundled gd_png.c stays
* identical to upstream libgd. */
if (strcmp(format, "gd-png: fatal libpng error: %s\n") == 0) {
format = "gd-png: fatal libpng error: %s";
} else if (strncmp(format, "gd-png error: setjmp returns error condition",

the expected output of the bundled libgd matches the expected output when using an external libgd.

Without this change, the test suite fails when using external gd.

This leaves us with the following test failures, all with external gd:

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #65148 (imagerotate may alter image dimensions) [ext/gd/tests/bug65148.phpt]
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation()) [ext/gd/tests/bug73272.phpt]
Bug #73291 (imagecropauto() $threshold differs from external libgd) [ext/gd/tests/bug73291.phpt]
=====================================================================

ext/gd/tests/bug73291.phpt is related to differences in the algorithm between the current stable libgd-2.3.3 and the bundled 2.4 pre-release, so we either need to split this into a new _external test, which will cause issues when distributions eventually start to ship a future 2.4 release, or we need to guard this behind a version check.

See gentoo/gentoo#46580 (comment) for more context.

Not sure about the other two failing tests though, but since they also got touched when updating the bundled libgd to 2.4pre, I bet it is the same issue.

@lotharsm

lotharsm commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Okay, the remaining ones are trickier, e.g. simply reverting the tests won't necessarily work, because the infra around it seemed to change. Might need a bit more time to investigate though.

@devnexen
devnexen merged commit 6ce322e into php:master Aug 9, 2026
18 checks passed
@devnexen

devnexen commented Aug 9, 2026

Copy link
Copy Markdown
Member

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants