We've changed the way that objects are destroyed during shutdown to a 2-phase mechanism. First, destructors are called for all of the objects in the store (in no particular order). Afterwards - the object storage and the various symbol tables are destroyed&freed.

This has several implications:

1. The dependency problems during shutdown which could cause destructors not to be called under certain circumstances - are gone now. Destructors are always called for all objects, and you can depend on that.

2. A *VERY* important implication is that you cannot, and must not rely in any way on the order of destruction during shutdown. It runs in no particular order. That means that by the time the destructor for your object $foo is called, a reference to some other object $bar may already be post-destruction. Note that it will still be 'intact' and accessible in the sense that if you access it - there won't be crashes. However, if this object does indeed have a destructor, it can be considered semantically wrong to touch this object at this point.

3. The APIs have changed to allow for this new mechanism. Instead of the previous dtor callback, which was supposed to both call the destructor and free the object's storage, there are now two separate callbacks - dtor (call the destructor) and free_storage (guess). Generally, for classes which implement PHP-style objects, you should implement both of these callbacks (though you can probably use the standard dtor callback). For overloaded classes such as SimpleXML, COM, etc. - you will most likely only have to implement the free_storage callback, as there's no destructor per-se. We already went over all the overloaded classes in the php-src CVS and moved most of the dtor callbacks to free_storage. Note that the interface is slightly different between these two callbacks - free_storage doesn't receive the object handle.

4. Last but not least - bug #25541 is now fixed! :)

Andi

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



Reply via email to