<?php
class A { function __destruct() { echo "a dtor\n"; global $b; $b->doSomething(); } }
class B { function __destruct() { echo "b dtor\n"; } function doSomething() { echo "b still alive\n"; } }
$a = new A;
$b = new B;
b dtor
a dtor
Fatal error: Uncaught Error: Call to a member function doSomething() on null in /in/dP2Ev:2
Stack trace:
#0 [internal function]: A->__destruct()
#1 {main}
thrown in /in/dP2Ev on line 2
Process exited with code 255.
Output for 5.6.0 - 5.6.28
b dtor
a dtor
Fatal error: Call to a member function doSomething() on null in /in/dP2Ev on line 2
Process exited with code 255.