Re: Change the order in which Objects are unloaded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Niels Ganser wrote:
I use a Debugger-Class to collect debugging information (now that was a hard guess, wasn't it..) during script runtime. In order to collect everything there is to collect, I instantiate a debugger object right at the start of my scripts and unload this object at the very end of my shutdown function.

Unfortunately as of PHP 5.0.5 objects get unloaded before the shutdown function is even called and as Jani Taskinen pointed out [1] this behaviour is very much intended and won't get changed (whatever the reason for this decision might be..) with all related bugs marked Bogus [2] or a documentation issue [3].

I have to admit that it wouldn't be much of a deal to store the debugging information outside the object but I like the approach I took and fear that I might run into other problems with objects getting destroyed before others which depend on the previous ones, so my question is (tadaa): Is there a way to sort of "customize" the order in which objects are unloaded during the shutdown procedure? I have to stress that defining the classes and/or instantiate the objects in a specific order is _not_ an option.

[1] http://marc.theaimsgroup.com/?l=php-dev&m=112556389406774
[2] http://bugs.php.net/bug.php?id=34377
[3] http://bugs.php.net/bug.php?id=33772

This is a really nasty bug, which has been preventing me from upgrading to PHP 5.0.5. Unfortunately it doesn't look like it will be fixed any time soon. The most descriptive bug report is [3], bug ID 33772, above.

The only workaround I've come up with (although pretty ugly) is to use an auto_append_file [1] that executes the necessary destructors in the order you want them. This file will be executed before PHP starts destroying objects.

HTH

[1] http://php.net/ini.core#ini.auto-append-file
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux