ID:               26441
 Updated by:       [EMAIL PROTECTED]
 Reported By:      chernyshevsky at hotmail dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Zend Engine 2 problem
-Operating System: Win32
+Operating System: *
-PHP Version:      5.0.0b2 (beta2)
+PHP Version:      5CVS-2004-03-30
 New Comment:

This looks to me like a legitimate bug. Why was this 

bogused?



You can return other values from __set() without 

triggering this error and it makes sense to return 

$this->values[$name] to make it consistent with non-

overloaded property writes.


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

[2003-11-28 20:33:54] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

..

------------------------------------------------------------------------

[2003-11-28 01:13:50] chernyshevsky at hotmail dot com

Description:
------------
When __set() returns an element of a member array, it seems to corrupt
the array. Works as expected when "return" is removed. 

Reproduce code:
---------------
class Test {

        var $values;

        

        function __construct() {

                $this->values = array();

        }



        function __set($name, $value) {

                return $this->values[$name] = $value;

        }



        function __get($name) {

                return $this->values[$name];

        }

};



$a = new Test();

$a->greeting = "Hello";

echo $a->greeting;

Expected result:
----------------
Hello

Actual result:
--------------
1


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26441&edit=1

Reply via email to