ID: 42409 Comment by: ayvah at nessness dot org Reported By: luke dot mcildoon at niche dot com dot au Status: No Feedback Bug Type: Scripting Engine problem Operating System: Windows Vista 32-bit PHP Version: 5.2.3 New Comment:
I don't know if this bug has been fixed by this point, but I would like to confirm it in PHP version 5.2.4, in Ubuntu 8.04. It's fairly simple to invoke the bug. Essentially, when you access a value in an ArrayObject that doesn't exist, you seem to get NULL and you're able to treat the empty "NULL" value returned by an array as if it were an array. I've had a look around, and I can't find any other mention of the bug, so I'm kind of assuming it's still present. $array = new ArrayObject(); $array['notinarray'][] = "value"; var_dump($var['something']); var_dump($var2['somethingelse']); var_dump($var3[0]); Output: array(1) { [0]=> string(5) "value" } array(1) { [0]=> string(5) "value" } string(5) "value" Previous Comments: ------------------------------------------------------------------------ [2007-09-01 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-08-24 09:59:50] [EMAIL PROTECTED] How about you first provided an example script that has some way of working even the wrong way? The one here just says "Fatal error: Call to undefined function session()" ------------------------------------------------------------------------ [2007-08-24 06:55:54] luke dot mcildoon at niche dot com dot au Description: ------------ I have a class that returns an array by reference using __get(). As soon as you try to set a 2+ dimension on the array, the -> operator returns whatever you tried to assign to the referenced array. ie. session()->session['foo'][] = 'test'; print_r($this->var); #[0] => 'test' print_r($asdf->ghjk); #[0] => 'test' Basically, from any point after the first example line is used, any use of the -> operator, regardless of the object being referenced, will return whatever you tried to assign to the referenced array. Reproduce code: --------------- class session extends ArrayObject { public $data = array(); public function &__get($var) { if($var == 'session') { return $this; } } } session()->session[][] = 'test'; print_r($this->var); print_r($anything->var); print_r($this->foobar); Expected result: ---------------- The actual value of $this->var, then undefined property warnings. Actual result: -------------- [0] => 'test' [0] => 'test' [0] => 'test' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42409&edit=1