Re: ext/gd: changing signatures for functions returning true
| From: | Claude Pache | Date: | Tue, 27 May 2025 08:00:12 +0000 |
| Subject: | Re: ext/gd: changing signatures for functions returning true | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127477@lists.php.net to get a copy of this message | ||
> Le 27 mai 2025 à 00:51, David CARLIER <devnexen@gmail.com> a écrit :
>
> Hi,
>
> Working through this
> https://github.com/php/php-src/pull/18651/files, do not mind waiting
> for PHP 9 if needs be. Let me know what you think.
>
> Cheers.
Hi,
Those functions are documented to return false on failure (e.g. https://www.php.net/manual/en/function.imagesetthickness.php).
For that reason, I typically check for failure (e.g.,
if (! imagesetthickness(...)) { return
false; }).
If some or all functions of the gd library do not or no longer return false, please amend the
documentation, so that I (and everyone else, see e.g. https://phpstan.org/r/a69b0ad4-b4bd-4487-a6d1-a436ce142dc2
) know that those checks are useless without needing to read the php source code.
But don’t just change the return type from bool to void: you are
needlessly breaking existing code. Thanks!
—Claude