#20175 [Opn->]: Array key -1 can crash PHP

From: Date: Sun, 10 Nov 2002 17:53:30 +0000
Subject: #20175 [Opn->]: Array key -1 can crash PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-24443@lists.php.net to get a copy of this message
ID: 20175 Updated by: stas@php.net -Summary: Static vars can't store ref to new instance -Reported By: enigma@turingstudio.com +Reported By: carl@thep.lu.se -Status: Open +Status: Won\'t fix Bug Type: Scripting Engine problem -Operating System: All +Operating System: Linux -PHP Version: 4.2.1 +PHP Version: 4.3.0-dev New Comment: This is fixed in CVS for ZE2. I don't think this would be fixed for ZE1, so I put it as wontfix for now. Previous Comments: ------------------------------------------------------------------------ [2002-10-30 14:07:08] enigma@turingstudio.com Heh, I'm certain it does, but I'll ask andi on the list to check for us. It would be reeeeeeally nice yo have for us in 4.2 though :) Thanks for the quick response. _a ------------------------------------------------------------------------ [2002-10-30 13:37:46] derick@php.net Can you see if Zend Engine 2 solves this? Derick ------------------------------------------------------------------------ [2002-10-30 13:34:48] enigma@turingstudio.com ola, we've recently put in a set of methods in the binarycloud core classes so they can enforce their singleton status. An example: // {{{ method GetInstance() /** * This method enforces this class's singleton * status. It check s astatic var for an instance, * if that instance exists a reference to it * is returned. If it does not exist it is created * and a reference is returned. * @author hans lellelid, hans@velum.net * @access public */ function &GetInstance() { static $instance; if(!isset($instance)) { $instance = new Request(); } return $instance; } // }}} note the line: $instance = new Request(); that means the instance is always overwritten. we have to do that because: $instance =& new Request(); results in a null $instance. We believe this is a bug, but it's on the edge of possible expected behavior. thanks, _alex ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20175&edit=1

« previous php.bugs (#24443) next »