summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xZend/tests/bug32226.phpt36
-rw-r--r--Zend/zend_builtin_functions.c2
2 files changed, 37 insertions, 1 deletions
diff --git a/Zend/tests/bug32226.phpt b/Zend/tests/bug32226.phpt
new file mode 100755
index 0000000000..b2bd754c28
--- /dev/null
+++ b/Zend/tests/bug32226.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug # 32226 (SEGV with exception handler on non existing instance)
+--FILE--
+<?
+
+class A
+{
+ public function A()
+ {
+ set_exception_handler(array($this, 'EH'));
+
+ throw new Exception();
+ }
+
+ public function EH()
+ {
+ restore_exception_handler();
+
+ throw new Exception();
+ }
+}
+
+try
+{
+$a = new A();
+}
+catch(Exception $e)
+{
+ echo "Caught\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Caught
+===DONE===
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 4428828ac1..45df85006f 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1737,7 +1737,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
if (function_name) {
add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
- if (ptr->object) {
+ if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) {
class_name = Z_OBJCE(*ptr->object)->name;
call_type = "->";
} else if (ptr->function_state.function->common.scope) {