cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug43175.phpt
| From: | Dmitry Stogov | Date: | Tue, 06 Nov 2007 14:56:32 +0000 |
| Subject: | cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug43175.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6134@lists.php.net to get a copy of this message | ||
dmitry Tue Nov 6 14:56:32 2007 UTC
Modified files:
/ZendEngine2 zend_vm_def.h zend_vm_execute.h
/ZendEngine2/tests bug43175.phpt
Log:
Fixed bug #43175 (__destruct() throwing an exception with __call() causes segfault)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.195&r2=1.196&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.195 ZendEngine2/zend_vm_def.h:1.196
--- ZendEngine2/zend_vm_def.h:1.195 Tue Nov 6 14:12:14 2007
+++ ZendEngine2/zend_vm_def.h Tue Nov 6 14:56:32 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.195 2007/11/06 14:12:14 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.196 2007/11/06 14:56:32 dmitry Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -2167,6 +2167,9 @@
}
}
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EG(function_state_ptr) = &EX(function_state);
+
if (EG(This)) {
if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) {
if (IS_CTOR_USED(EX(called_scope))) {
@@ -2190,8 +2193,6 @@
EG(called_scope) = current_called_scope;
}
- EX(function_state).function = (zend_function *) EX(op_array);
- EG(function_state_ptr) = &EX(function_state);
zend_ptr_stack_clear_multiple(TSRMLS_C);
if (EG(exception)) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.199&r2=1.200&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.199 ZendEngine2/zend_vm_execute.h:1.200
--- ZendEngine2/zend_vm_execute.h:1.199 Tue Nov 6 14:12:14 2007
+++ ZendEngine2/zend_vm_execute.h Tue Nov 6 14:56:32 2007
@@ -283,6 +283,9 @@
}
}
+ EX(function_state).function = (zend_function *) EX(op_array);
+ EG(function_state_ptr) = &EX(function_state);
+
if (EG(This)) {
if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) {
if (IS_CTOR_USED(EX(called_scope))) {
@@ -306,8 +309,6 @@
EG(called_scope) = current_called_scope;
}
- EX(function_state).function = (zend_function *) EX(op_array);
- EG(function_state_ptr) = &EX(function_state);
zend_ptr_stack_clear_multiple(TSRMLS_C);
if (EG(exception)) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug43175.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug43175.phpt
diff -u /dev/null ZendEngine2/tests/bug43175.phpt:1.2
--- /dev/null Tue Nov 6 14:56:32 2007
+++ ZendEngine2/tests/bug43175.phpt Tue Nov 6 14:56:32 2007
@@ -0,0 +1,24 @@
+--TEST--
+Bug #43175 (__destruct() throwing an exception with __call() causes segfault)
+--FILE--
+<?php
+
+class foobar {
+ public function __destruct() {
+ throw new Exception();
+ }
+ public function __call($m, $a) {
+ return $this;
+ }
+}
+function foobar() {
+ return new foobar();
+}
+try {
+ foobar()->unknown();
+} catch (Exception $e) {
+ echo "__call via traditional factory should be caught\n";
+}
+?>
+--EXPECT--
+__call via traditional factory should be caught