#32852 [Opn->Fbk]: Crash with singleton and __destruct

From: Date: Wed, 27 Apr 2005 10:52:32 +0000
Subject: #32852 [Opn->Fbk]: Crash with singleton and __destruct
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78274@lists.php.net to get a copy of this message
ID: 32852 Updated by: tony2001@php.net Reported By: cox at idecnet dot com -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: Linux PHP Version: 5.0.4 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-04-27 12:44:58] cox at idecnet dot com Description: ------------ Crash with singleton() and __destruct(), see below. Tomas V.V.Cox Reproduce code: --------------- <?php class crashme { private static $instance = null; public function __construct() { self::$instance = $this; } public function __destruct() { echo "i'm called\n"; } public static function singleton() { if (!isset(self::$instance)) { self::$instance = new crashme(); } return self::$instance; } } crashme::singleton(); ?> Expected result: ---------------- i'm called Actual result: -------------- i'm called i'm called Segmentation fault (core dumped) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32852&edit=1

« previous php.bugs (#78274) next »