summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-10-18 15:04:49 +0300
committerDmitry Stogov <dmitry@zend.com>2016-10-18 15:04:49 +0300
commit7bd4e7208e26e3e441717c0f33a154a385764d06 (patch)
tree0be92733e3e6f5f621b39cd3921d0c9304c38634
parent8c74be0c52d8d1d9c7304385b3c9c7a1bfb8b873 (diff)
parent6558559bcc1cd24e3639e4a215e9d546ee05fc48 (diff)
downloadphp-git-7bd4e7208e26e3e441717c0f33a154a385764d06.tar.gz
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6: Fixed bug #73337 (try/catch not working with two exceptions inside a same operation)
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug73337.phpt12
-rw-r--r--Zend/zend_execute_API.c3
3 files changed, 17 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 12350672af..be20d3ba96 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP NEWS
. Fixed bug #66862 ((Sub-)Namespaces unexpected behaviour). (Nikita)
. Fix pthreads detection when cross-compiling (ffontaine)
. Fixed bug #73215 (uniqid() should use better random source). (Yasuo)
+ . Fixed bug #73337 (try/catch not working with two exceptions inside a same
+ operation). (Dmitry)
- GD:
. Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb)
diff --git a/Zend/tests/bug73337.phpt b/Zend/tests/bug73337.phpt
new file mode 100644
index 0000000000..9eff18e643
--- /dev/null
+++ b/Zend/tests/bug73337.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #73337 (try/catch not working with two exceptions inside a same operation)
+--FILE--
+<?php
+class d { function __destruct() { throw new Exception; } }
+try { new d + new d; } catch (Exception $e) { print "Exception properly caught\n"; }
+?>
+--EXPECTF--
+Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
+
+Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
+Exception properly caught
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 194f16df48..f96cac5f09 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -852,8 +852,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
EG(scope) = func->common.scope;
call->symbol_table = fci->symbol_table;
if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) {
+ const zend_op *current_opline_before_exception = EG(opline_before_exception);
+
zend_init_execute_data(call, &func->op_array, fci->retval);
zend_execute_ex(call);
+ EG(opline_before_exception) = current_opline_before_exception;
} else {
zend_generator_create_zval(call, &func->op_array, fci->retval);
}