#32626 [Com]: dynamic object reference is not stored in a static var

From: Date: Thu, 07 Apr 2005 19:55:47 +0000
Subject: #32626 [Com]: dynamic object reference is not stored in a static var
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76500@lists.php.net to get a copy of this message
ID: 32626 Comment by: phpbugs at majiclab dot com Reported By: jon dot brightwell at s2o dot co dot uk Status: Open Bug Type: Class/Object related Operating System: W2k srv IIS PHP Version: 5.0.4 New Comment: From what I see, you haven't declared a static class variable in io_tower. Previous Comments: ------------------------------------------------------------------------ [2005-04-07 18:29:49] jon dot brightwell at s2o dot co dot uk latest snapshot (5.1.0-dev) does work but breaks zends debugger; Failed loading C:\Program Files\Zend\ZendStudioClient-4.0.0\lib\php5\ZendDebuggerLocal.dll is there a snapshot that is still zend 4 compatible with the fix in? ------------------------------------------------------------------------ [2005-04-07 18:14:12] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-04-07 18:13:15] jon dot brightwell at s2o dot co dot uk Description: ------------ $mcp is a class instance. constructor of mcp stores a reference of itself in a seperate static class. Reproduce code: --------------- $yo = new mcp(); class mcp { public function __construct() { io_tower::setMCP($this); } } class io_tower { static public function getMCP() { return self::$mcp; } static public function setMCP($import) { try { if(is_object(self::$mcp)) throw new Exception("MCP already exists"); }catch (Exception $e){return;} self::$mcp= $import; } } Expected result: ---------------- io_tower(self)::$mcp = instance of mcp ie. io_tower::getMCP() = instance Actual result: -------------- io_tower(self)::$mcp = null ie. io_tower::getMCP() = null ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32626&edit=1

« previous php.bugs (#76500) next »