ID: 29685 Updated by: [EMAIL PROTECTED] Reported By: sampw at hotmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Win XP SP2 PHP Version: 5CVS-2004-08-15 (dev) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The dtor is called during shutdown. I don't see the slightest problem here. Previous Comments: ------------------------------------------------------------------------ [2004-08-15 01:28:06] sampw at hotmail dot com Description: ------------ Destructor is not called to late. If you use a singleton pattern unset does not work, because there exist a private static reference for the object. Why is the destructor called so unreliable? Is such a singleton pattern not possible in PHP? Or must the static $instance be public, inorder to unset it manually? (Not a nice solution?!) Reproduce code: --------------- class Session { //Db Session (Singleton) static private $instance = false; private function __construct() { } public function __destruct() { $this->sessionWriteClose(); // e.G. store session data } static function instance() { if(!Session::$instance) Session::$instance = new Session(); return Session::$instance; } } $OBJ_SESSION = Session::instance(); unset($OBJ_SESSION); // Does not work, because of the static private $instance ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29685&edit=1