ext/gd: Fix comparison with result of php_stream_can_cast()

Closes GH-19107
This commit is contained in:
Gina Peter Banyard 2025-07-12 18:30:08 +01:00
parent 17df11e3f7
commit 83b8d2c290
No known key found for this signature in database
GPG key ID: F30F8C1ACF51943F
2 changed files with 4 additions and 1 deletions

3
NEWS
View file

@ -11,6 +11,9 @@ PHP NEWS
- FTP:
. Fix theoretical issues with hrtime() not being available. (nielsdos)
- GD:
. Fix incorrect comparison with result of php_stream_can_cast(). (Girgias)
- Hash:
. Fix crash on clone failure. (nielsdos)

View file

@ -1566,7 +1566,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
pefree(pstr, 1);
zend_string_release_ex(buff, 0);
}
else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO)) {
else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO) == SUCCESS) {
/* try and force the stream to be FILE* */
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void **) &fp, REPORT_ERRORS)) {
goto out_err;