ID:               24485
 Updated by:       [EMAIL PROTECTED]
 Reported By:      gomez at efrei dot fr
-Status:           Open
+Status:           Verified
 Bug Type:         Scripting Engine problem
 Operating System: windows and linux
-PHP Version:      4.3.2
+PHP Version:      4.3.3RC2-dev, 5.0.0b2-dev
 New Comment:

Same result with both PHP 4.3.3RC2-dev and 5.0.0b2-dev.



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

[2003-07-03 10:17:47] gomez at efrei dot fr

Description:
------------
In an array, classes become classes references when I use a function
member.

Because of that, I don't copy it anymore, I just produce more  pointers
to it.
(see the '&' in the var dump)

If you comment the magic line, the bug won't appear.

Tested under linux (php 4.1.2 and 4.2.3)
and windows (php 4.3.2)

Reproduce code:
---------------
<?php
class AAAAA  {
    var $value;
    function AAAAA() {}
    function show() { return 5; }
}
$A = array(new AAAAA());
    $A[0]->show(); /* magic line */
$A[0]->value = 'A';
$B = $A;
$B[0]->value = 'B';
echo $A[0]->value.$B[0]->value;
echo "\n";
var_dump( $A );

?>

Expected result:
----------------
AB
array(1) {
  [0]=>
  object(aaaaa)(1) {
    ["value"]=>
    string(1) "A"
  }
}

Actual result:
--------------
BB
array(1) {
  [0]=>
  &object(aaaaa)(1) {
    ["value"]=>
    string(1) "B"
  }
}



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


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

Reply via email to