From:             ian at ardes dot com
Operating system: OS X 10.2.6
PHP version:      4.3.3RC3
PHP Bug Type:     Class/Object related
Bug description:  overload() messes with array member variables

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
)

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

Reply via email to