com php-src: Also check for exception after stream_eof: m ain/streams/userspace.c
| From: | Nikita Popov | Date: | Thu, 10 Oct 2019 10:08:04 +0000 |
| Subject: | com php-src: Also check for exception after stream_eof: m ain/streams/userspace.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108858@lists.php.net to get a copy of this message | ||
Commit: f43f493e09b28d8d3924fbcea2392108ca7f5f65
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 10 Oct 2019 12:07:47 +0200
Parents: b02cf8b66eadbff1ca4ea385f9719d944a9a158a
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f43f493e09b28d8d3924fbcea2392108ca7f5f65
Log:
Also check for exception after stream_eof
Changed paths:
M main/streams/userspace.c
Diff:
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index af7f0b4fa28..91fd83954c1 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -700,12 +700,17 @@ static ssize_t php_userstreamop_read(php_stream *stream, char *buf, size_t
count
/* since the user stream has no way of setting the eof flag directly, we need to ask it if we hit
eof */
ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1);
-
call_result = call_user_function(NULL,
Z_ISUNDEF(us->object)? NULL : &us->object,
&func_name,
&retval,
0, NULL);
+ zval_ptr_dtor(&func_name);
+
+ if (EG(exception)) {
+ stream->eof = 1;
+ return -1;
+ }
if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF &&
zval_is_true(&retval)) {
stream->eof = 1;
@@ -718,7 +723,6 @@ static ssize_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
}
zval_ptr_dtor(&retval);
- zval_ptr_dtor(&func_name);
return didread;
}