ID: 26441
Updated by: [EMAIL PROTECTED]
Reported By: chernyshevsky at hotmail dot com
-Status: Open
+Status: Assigned
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2004-03-30
-Assigned To:
+Assigned To: andi
New Comment:
Andi, you decide if this is docu prob or real bug.. :)
Previous Comments:
------------------------------------------------------------------------
[2004-04-01 01:02:14] [EMAIL PROTECTED]
Okay, but it still shouldn't act screwy when you do
return that value. It should just ignore the return
value of __set().
------------------------------------------------------------------------
[2004-03-31 23:12:24] chernyshevsky at hotmail dot com
I think it was marked bogus because you don't actually need to return
from __set(). The engine will call __get() when you have something like
$a = $object->prop = "Hello".
------------------------------------------------------------------------
[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