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
add check to image create functions #2780
add check to image create functions #2780
Conversation
Thanks for taking this on! I’m not sure about the best approach to handle this. Error handling in general is still an open issue for the future: #2210. Until we didn’t define how we should handle errors, I think we should silently return without adding a message to the error log. |
…geistruecolor-argument-1-$image-must-be-of-type-gdimage-null-given-error # Conflicts: # src/Image/Operation/ToJpg.php # src/Image/Operation/ToWebp.php
Co-authored-by: Nicolas Lemoine <nico.lemoine@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all for thinking through the different solutions to this.
I wouldn’t drop support for PHP 7.4 for the 2.x release to provide an easier upgrade path.
But for the next major version, we can definitely drop it.
Related:
Issue
The imagecreatefrom functions should return false or an instance of GDimage. In the related issue null is returned, which is strange. But I think it is save to add an additional check to see whether we should postpone the image operation when the result of the function is null or false.
Solution
Check if $input has a value before continuing.
Impact
Better error handling.
Usage Changes
None
Considerations
There is a bit of overlap in these two classes. We might want to take a closer look at them in the future to make them more DRY.
Testing
no.