ID:               32334
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mk at peytz dot dk
-Status:           Open
+Status:           Verified
 Bug Type:         Zend Engine 2 problem
-Operating System: Linux
+Operating System: *
-PHP Version:      5CVS-2005-03-31
+PHP Version:      5CVS-2005-04-04
 New Comment:

Changed the var_export() -> var_dump() and got this with
latest CVS:

object(Setter)#1 (2) {
  ["_fields:private"]=>
  array(2) {
    ["a"]=>
    int(1)
    ["b"]=>
    int(2)
  }
  ["_changedFields:private"]=>
  array(2) {
    [0]=>
    string(1) "a"
    [1]=>
    &UNKNOWN:0
  }
}



Previous Comments:
------------------------------------------------------------------------

[2005-04-01 13:51:43] mk at peytz dot dk

Still present in 5.0.4 but now only with NULL values.

------------------------------------------------------------------------

[2005-03-19 12:38:36] [EMAIL PROTECTED]

Can't reproduce *your* behaviour with latest 5.0.x & 5.1 CVS.
But some issue really exists, as I get NULL instead of 'b' with both
branches.


------------------------------------------------------------------------

[2005-03-16 13:29:45] mk at peytz dot dk

Description:
------------
When setting variable variable values on a instance of a class with an
overloading __set function changing another instance variable goes
wrong.

(I'm reporting it for version 5.0.3 because the current cvs snapshot
would not compile.)

Reproduce code:
---------------
http://dev.peytz.dk/~mk/setter.php
<?php
class Setter
{
    private $_fields = array(); // the data fields
    private $_changedFields = array(); // list of changed fields

    function __set($name, $value)
    {
        // set value
        $this->_fields[$name] = $value;
        // add to list of changed fields
        $this->_changedFields[] = $name;
    }
}
$foo = new Setter;
$foo->a = 1;
$var = "b";
$foo->$var = 2;
var_export($foo);
?>

Expected result:
----------------
class Setter {
  private $_fields = 
  array (
    'a' => 1,
    'b' => 2,
  );
  private $_changedFields = 
  array (
    0 => 'a',
    1 => 'b',
  );
}

Actual result:
--------------
class Setter {
  private $_fields = 
  array (
    'a' => 1,
    'b' => 2,
  );
  private $_changedFields = 
  array (
    0 => 'a',
    1 => '›‡ˆ',
  );
}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32334&edit=1

Reply via email to