On 20/03/2018 22:13, Dennis Birkholz wrote:
P.s.: In addition to the call order, in auto-close case autoloading with registered autoloaders does not work inside stream_flush and stream_close, it seems registered autoloaders (maybe all objects) have been dispatched when the calls happen, see: https://3v4l.org/GB7Mm
The behaviour with the stream wrapper certainly seems wrong to me, since there is clearly still a reference to the object after its destructor is called.
The autoloader not being available seems reasonable, though - during shutdown, the engine has to start unpicking various global state in order to cleanly release any references, and there is no order to do this that would guarantee no code breaking. You demonstrate a stream wrapper relying on an autoloader, but we could equally have an autoloader that relied on a stream wrapper. If both needed to be available for the other, the engine could never cleanly free any resources they held, so it has to start somewhere. In general, anything that might run on shutdown, such as a destructor, should be very conservative in its assumptions about the engine's state.
Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php