[patch] Zend/zend_objects_API.c - bug #29980 (segfault while executing __destruct())
| From: | Antony Dovgal | Date: | Fri, 10 Sep 2004 05:57:25 +0000 |
| Subject: | [patch] Zend/zend_objects_API.c - bug #29980 (segfault while executing __destruct()) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-12697@lists.php.net to get a copy of this message | ||
And the last one, the most questionable patch.
ATM ZE2 calls destructor at the end of the request and no matter
is there were a fatal error (which should probably stop executing the script).
In some cases it leads to nasty segfaults (me and report's author can reproduce
it, but others can't. weird..).
Some persons (hello, Andrey =)) think that this could be a useful feature, but
for me it's just an inconsistency. IMO destructors should not be called after
fatal errors, because they can cause even more harm.
--
Wbr,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com
Index: zend_objects_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_objects_API.c,v retrieving revision 1.42 diff -u -r1.42 zend_objects_API.c --- zend_objects_API.c 25 Jul 2004 17:25:44 -0000 1.42 +++ zend_objects_API.c 6 Sep 2004 05:30:23 -0000 @@ -140,7 +140,7 @@ if (!EG(objects_store).object_buckets[handle].destructor_called) { EG(objects_store).object_buckets[handle].destructor_called = 1; - if (obj->dtor) { + if (EG(exit_status) == SUCCESS && obj->dtor) { /* only call destructor if there was no fatal errors before */ obj->dtor(obj->object, handle TSRMLS_CC); } }
Index: zend_objects_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_objects_API.c,v retrieving revision 1.42 diff -u -r1.42 zend_objects_API.c --- zend_objects_API.c 25 Jul 2004 17:25:44 -0000 1.42 +++ zend_objects_API.c 6 Sep 2004 05:30:23 -0000 @@ -140,7 +140,7 @@ if (!EG(objects_store).object_buckets[handle].destructor_called) { EG(objects_store).object_buckets[handle].destructor_called = 1; - if (obj->dtor) { + if (EG(exit_status) == SUCCESS && obj->dtor) { /* only call destructor if there was no fatal errors before */ obj->dtor(obj->object, handle TSRMLS_CC); } }