Skip to content

Commit f43f493

Browse files
committed
Also check for exception after stream_eof
1 parent b02cf8b commit f43f493

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main/streams/userspace.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,12 +700,17 @@ static ssize_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
700700
/* since the user stream has no way of setting the eof flag directly, we need to ask it if we hit eof */
701701

702702
ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1);
703-
704703
call_result = call_user_function(NULL,
705704
Z_ISUNDEF(us->object)? NULL : &us->object,
706705
&func_name,
707706
&retval,
708707
0, NULL);
708+
zval_ptr_dtor(&func_name);
709+
710+
if (EG(exception)) {
711+
stream->eof = 1;
712+
return -1;
713+
}
709714

710715
if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval)) {
711716
stream->eof = 1;
@@ -718,7 +723,6 @@ static ssize_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
718723
}
719724

720725
zval_ptr_dtor(&retval);
721-
zval_ptr_dtor(&func_name);
722726

723727
return didread;
724728
}

0 commit comments

Comments
 (0)