]> granicus.if.org Git - php/commitdiff
- MFH
authorMarcus Boerger <helly@php.net>
Mon, 7 Mar 2005 19:34:03 +0000 (19:34 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 7 Mar 2005 19:34:03 +0000 (19:34 +0000)
Zend/tests/bug32226.phpt [new file with mode: 0755]
Zend/zend_builtin_functions.c

diff --git a/Zend/tests/bug32226.phpt b/Zend/tests/bug32226.phpt
new file mode 100755 (executable)
index 0000000..b2bd754
--- /dev/null
@@ -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===
index 4428828ac1865c7d366c39657ed40da4544cd325..45df85006f21ab0911ed79184919949e677e89c2 100644 (file)
@@ -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) {