summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2016-10-11 21:14:25 -0700
committerSara Golemon <pollita@php.net>2016-10-11 21:55:01 -0700
commit43ccf23d700ae780451e257f5a66d4210f82f026 (patch)
tree51dfeedc72897bd3a5b23afa99e04c2bbe444829 /main
parent689a9b8def07875641b3132a82c701fb7acb676c (diff)
downloadphp-git-43ccf23d700ae780451e257f5a66d4210f82f026.tar.gz
Clear FG(user_stream_current_filename) when bailing out
If a userwrapper opener E_ERRORs then FG(user_stream_current_filename) would remain set until the next request and would not be pointing at unallocated memory. Catch the bailout, clear the variable, then continue bailing. Closes https://bugs.php.net/bug.php?id=73188
Diffstat (limited to 'main')
-rw-r--r--main/streams/userspace.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index e65f605b12..37c0a176ed 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -394,12 +394,17 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
MAKE_STD_ZVAL(zfuncname);
ZVAL_STRING(zfuncname, USERSTREAM_OPEN, 1);
- call_result = call_user_function_ex(NULL,
- &us->object,
- zfuncname,
- &zretval,
- 4, args,
- 0, NULL TSRMLS_CC);
+ zend_try {
+ call_result = call_user_function_ex(NULL,
+ &us->object,
+ zfuncname,
+ &zretval,
+ 4, args,
+ 0, NULL TSRMLS_CC);
+ } zend_catch {
+ FG(user_stream_current_filename) = NULL;
+ zend_bailout();
+ } zend_end_try();
if (call_result == SUCCESS && zretval != NULL && zval_is_true(zretval)) {
/* the stream is now open! */