ID: 35123 Updated by: [EMAIL PROTECTED] Reported By: joe at popcast dot com -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: linux, XP, Mac PHP Version: 5.0.5 New Comment:
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 Previous Comments: ------------------------------------------------------------------------ [2005-11-06 09:42:14] joe at popcast dot com Description: ------------ Using PHP from the standard Windows installer and running under Apache, the following code both produces unexpected output and crashes PHP. The code is a simple OOP variable test. A similar bug was posted (http://bugs.php.net/bug.php?id=26930) but did not crash PHP. To reproduce the crash, uncomment the test method in class B or C and seg fault away. The bug is reproducible on every OS I've tested, including Linux and Mac with standard PHP installs running under Apache. Reproduce code: --------------- class A { protected static $instance; public $test = "A"; public function getInstance() { if (! self::$instance) self::$instance = new A; return self::$instance; } public function test() { echo $this->test; } } class B extends A { protected static $instance; //protected $test = "B"; public function getInstance() { if (! self::$instance) self::$instance = new B; self::$instance->test = "B"; return self::$instance; } /* public function test() { echo $this->test(); } */ } class C extends A { protected static $instance; //protected $test = "C"; public function getInstance() { if (! self::$instance) self::$instance = new C; self::$instance->test = "C"; return self::$instance; } /* public function test() { echo $this->test(); } */ } $a = new A; $a->test(); echo "\n----------<br>\n"; $b = new B; $a->test(); $b->test(); echo "\n----------<br>\n"; $c = new C; $a->test(); $b->test(); $c->test(); echo "\n----------<br>\n"; Expected result: ---------------- A ---------- AB ---------- ABC ---------- Actual result: -------------- A ---------- AA ---------- AAA ---------- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35123&edit=1