On Thu, 8 Sep 2005, Stanislav Malyshev wrote:

> DR>>But they can still do that.. With "shutdown functions" I meant 
> DR>>functions registered with register_shutdown_function().
> 
> Ah... This is smaller problem - register_shutdown_function() ones can be 
> called on "before dtors" stage.

Indeed, we've always done this too... I've a patch ready to commit for 
PHP 5.1/6.0 for this:

diff -u -p -d -r1.640 main.c
--- main.c      5 Aug 2005 21:44:26 -0000       1.640
+++ main.c      8 Sep 2005 11:33:43 -0000
@@ -1197,16 +1197,16 @@ void php_request_shutdown(void *dummy)
        EG(opline_ptr) = NULL;
        EG(active_op_array) = NULL;

-       /* 1. Call all possible __destruct() functions */
-       zend_try {
-               zend_call_destructors(TSRMLS_C);
-       } zend_end_try();
-
-       /* 2. Call all possible shutdown functions registered with 
register_shutdown_function() */
+       /* 1. Call all possible shutdown functions registered with 
register_shutdown_function() */
        if (PG(modules_activated)) zend_try {
                php_call_shutdown_functions(TSRMLS_C);
        } zend_end_try();

+       /* 2. Call all possible __destruct() functions */
+       zend_try {
+               zend_call_destructors(TSRMLS_C);
+       } zend_end_try();
+
        /* 3. Flush all output buffers */
        zend_try {
                
php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);


Derick
-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to