#26059 [Ver->Csd]: Call to __set() crashes when setting array element
| From: | helly@php.net | Date: | Mon, 16 Feb 2004 00:07:04 +0000 |
| Subject: | #26059 [Ver->Csd]: Call to __set() crashes when setting array element | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-54969@lists.php.net to get a copy of this message | ||
ID: 26059
Updated by: helly@php.net
Reported By: myle34 at hotmail dot com
-Status: Verified
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2004-02-10
New Comment:
Thie script is no longer possible since it produces a fatal error. The
problem here was accessing an indexed value through a virtual property
of type array. This is now no longer possible, you may want to use
array overloading instead.
Previous Comments:
------------------------------------------------------------------------
[2003-10-31 12:41:29] myle34 at hotmail dot com
Description:
------------
I am using PHP5-b2 and Apache 2.0.47 with Windows XP. Apache crashes
when the below code is run.
Reproduce code:
---------------
class Foo {
private $bar = array();
function __get($var) {
return(isset($this->bar[$var]) ? $this->bar[$var] : NULL);
}
function __set($var,$val) {
$this->bar[$var] = $val;
}
}
$foo = new Foo();
// Works
// $foo->test = array('testing'=>'testing, 1...2...3...');
// Doesn't work, crashes Apache
$foo->test = array();
$foo->test['testing'] = 'testing, 1...2...3...';
print_r($foo->test);
Expected result:
----------------
Array
(
[testing] => testing, 1...2...3...
)
Actual result:
--------------
Apache crashes! No output.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26059&edit=1