Skip to content

Commit 83b8d2c

Browse files
committed
ext/gd: Fix comparison with result of php_stream_can_cast()
Closes GH-19107
1 parent 17df11e commit 83b8d2c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
- FTP:
1212
. Fix theoretical issues with hrtime() not being available. (nielsdos)
1313

14+
- GD:
15+
. Fix incorrect comparison with result of php_stream_can_cast(). (Girgias)
16+
1417
- Hash:
1518
. Fix crash on clone failure. (nielsdos)
1619

ext/gd/gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
15661566
pefree(pstr, 1);
15671567
zend_string_release_ex(buff, 0);
15681568
}
1569-
else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO)) {
1569+
else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO) == SUCCESS) {
15701570
/* try and force the stream to be FILE* */
15711571
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void **) &fp, REPORT_ERRORS)) {
15721572
goto out_err;

0 commit comments

Comments
 (0)