Skip to content

Skip PNG tests if the system libgd is missing PNG support #13040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 31, 2023

Conversation

orlitzky
Copy link
Contributor

Now that the system image formats are being detected properly (85e5635a), there are several PNG tests that need to be skipped if the system libgd is missing PNG support. Nothing exciting here I hope.

Three of our gd tests could be skipped with a message about requiring
bundled GD, but those tests don't actually require bundled GD. We
update the messages to mention the specific functions that are
required.
The bundled libgd always has PNG support, but an external one may not.
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a lot of the reason why PNG is required is to load the known good image to compare.

if (!function_exists("imagerotate")) die("skip requires bundled GD library\n");
if (!function_exists("imagerotate")) die("skip requires imagerotate function");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it just require this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, obviously not. But instead of adding more checks, maybe we need fewer. Can this fail at all?

My inspiration for skip requires imagerotate function was a combination of the test description and some other tests that do the same thing. But I think these may all date back to a time when the bundled libgd had gdImageRotateInterpolated() but the external libgd might not have. These days both should have it (it's ten years old, and not guarded by an #ifdef), so the function_exists() check is probably pointless. None of the other image* functions are #ifdefed either.

I can remove the check if you think that's best.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing them is probably best then yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy enough. I tracked down the exact commit where the #ifdef was removed for imagerotate(), it was even older than I thought.

Following 59ec80c, the imagerotate() function is always available. We
may therefore remove its function_exists() checks without harm.
@Girgias Girgias merged commit 7f8adf8 into php:master Dec 31, 2023
@Girgias
Copy link
Member

Girgias commented Dec 31, 2023

Thank you !

@orlitzky
Copy link
Contributor Author

Any chance this will make it into 8.3.x? Otherwise our tests can fail during (and preventing) installation. I can patch in the meantime but it hits a lot of files.

@Girgias
Copy link
Member

Girgias commented Jul 10, 2024

Sure we can backport the fixes, I'll see if I can get round to it, is this also an issue on 8.2?

@orlitzky
Copy link
Contributor Author

Sure we can backport the fixes, I'll see if I can get round to it, is this also an issue on 8.2?

Yes, technically, but I'm only switching to the system libgd for our 8.3 packages, so probably no one else will notice.

@pierrejoye
Copy link
Contributor

pierrejoye commented Jul 10, 2024 via email

@orlitzky
Copy link
Contributor Author

ping :)

I see that #14905 made it into 8.3.10 but the others are still failing.

@orlitzky
Copy link
Contributor Author

Same thing in 8.3.11, can this pretty please be merged for 8.3.x?

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.

3 participants