]> granicus.if.org Git - php/commitdiff
Fixed bug #35437 (Segfault or Invalid Opcode 137/1/4)
authorDmitry Stogov <dmitry@php.net>
Thu, 1 Dec 2005 12:51:19 +0000 (12:51 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 1 Dec 2005 12:51:19 +0000 (12:51 +0000)
Zend/tests/bug35437.phpt [new file with mode: 0755]
Zend/zend_vm_execute.h
Zend/zend_vm_execute.skl

diff --git a/Zend/tests/bug35437.phpt b/Zend/tests/bug35437.phpt
new file mode 100755 (executable)
index 0000000..eecdee9
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Bug #35437 Segfault or Invalid Opcode 137/1/4 
+--FILE--
+<?php
+function err2exception($errno, $errstr)
+{
+       throw new Exception("Error occuried: " . $errstr);
+}
+
+set_error_handler('err2exception');
+
+class TestClass
+{
+       function testMethod()
+       {
+               $GLOBALS['t'] = new stdClass;
+       }
+}
+
+try {
+       TestClass::testMethod();
+} catch (Exception $e) {
+       echo "Catched: ".$e->getMessage()."\n";
+}
+?>
+--EXPECT--
+Catched: Error occuried: Non-static method TestClass::testMethod() should not be called statically
index 7a6dc541d92d2f84dc6181eb4975d2727642db45..b7c9e60a4b5277dc2ffdf086f27b241953044e1d 100644 (file)
@@ -36,6 +36,10 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
        zend_execute_data execute_data;
 
 
+       if (EG(exception)) {
+               return;
+       }
+
        /* Initialize execute_data */
        EX(fbc) = NULL;
        EX(object) = NULL;
index 6cfd1bbcd3057f3782efa2b64e42618a91d75bcc..9a3bd5038dcb67433e84f8671e1ee80243041686 100644 (file)
@@ -7,6 +7,10 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
 
        {%INTERNAL_LABELS%}
 
+       if (EG(exception)) {
+               return;
+       }
+
        /* Initialize execute_data */
        EX(fbc) = NULL;
        EX(object) = NULL;