ID:               42409
 Updated by:       [EMAIL PROTECTED]
 Reported By:      luke dot mcildoon at niche dot com dot au
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: Windows Vista 32-bit
 PHP Version:      5.2.3
 New Comment:

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()"


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to