From:             chernyshevsky at hotmail dot com
Operating system: Win32
PHP version:      5.0.0b2 (beta2)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Strange behavior when __set() return a member variable

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 bug report at http://bugs.php.net/?id=26441&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26441&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26441&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26441&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26441&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26441&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26441&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26441&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26441&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26441&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26441&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26441&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26441&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26441&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26441&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26441&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26441&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26441&r=float

Reply via email to