|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-17 15:52 UTC] andrei@php.net
[2004-02-17 16:37 UTC] sniper@php.net
[2004-02-24 10:05 UTC] ian at ardes dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
Description: ------------ Summary: When a class is overloaded with overload(), array member variables go wrong. If you overload a class, then access to declared array member variables from within member functions (and anywhere else I think) stops working correctly. The very simple class in the code should not change it's behaviour at all once it is overloaded. But it does. Reproduce code: --------------- class Overloaded { var $_my_array = array(); function Overloaded() { $this->_my_array[1] = '1st element'; } function __get($nm, &$val) { return false; } function __set($nm, $val) { return false; } } $o1 = new Overloaded(); print ("before overload(): "); print_r($o1); overload('Overloaded'); $o2 = new Overloaded(); print ("after overload(): "); print_r($o2); Expected result: ---------------- before overload(): overloaded Object ( [_my_array] => Array ( [1] => 1st element ) ) after overload(): overloaded Object ( [_my_array] => Array ( [1] => 1st element ) ) Actual result: -------------- before overload(): overloaded Object ( [_my_array] => Array ( [1] => 1st element ) ) after overload(): overloaded Object ( [_my_array] => 1st element )