#26441 [Opn->Bgs]: Strange behavior when __set() return a member variable

From: Date: Sat, 29 Nov 2003 01:33:55 +0000
Subject: #26441 [Opn->Bgs]: Strange behavior when __set() return a member variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51273@lists.php.net to get a copy of this message
ID: 26441 Updated by: sniper@php.net Reported By: chernyshevsky at hotmail dot com -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: Win32 PHP Version: 5.0.0b2 (beta2) New Comment: 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 .. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#51273) next »