Skip to content

Conversation

javajawa
Copy link

The GD group of image output functions has the capability to not output to a file, but the raw data is not returned by the function. Instead, the function echos the data into the equivalent of php://output, and returns a boolean for success or failure.

To quote the wording I previously misread on https://www.php.net/manual/en/function.imagepng.php:

The path or an open stream resource [...] to save the file to.
If not set or NULL, the raw image stream will be outputted directly.

This change mostly reverts #265, but leaves corrected tests in place.

(Sorry, because of the environment I originally tested these functions in, the return type mismatch error was getting swallowed under the image having already been outputted)

The GD group of image output functions has the capability to not output to a file, but the raw data is not returned by the function. Instead, the function echos the data into the equivelant of `php://output`, and returns a boolean for success or failure. To quote the wording I previously misread on https://www.php.net/manual/en/function.imagepng.php: > The path or an open stream resource [...] to save the file to. > If not set or NULL, the raw image stream will be outputted directly.
@ondrejmirtes ondrejmirtes merged commit 0823d22 into phpstan:master Jul 16, 2020
@ondrejmirtes
Copy link
Member

Thank you!

@javajawa javajawa deleted the gd-functions-with-null-filenames branch July 16, 2020 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants