From:             btb_tp at yahoo dot com
Operating system: Windows XP SP2
PHP version:      5.0.2
PHP Bug Type:     Unknown/Other Function
Bug description:  Append the Object into array result incorrect

Description:
------------
Below code work with PHP 4.3.9!!!

Reproduce code:
---------------
class A{
        protected $value = 0;
        function A($value){
                $this->value = $value;}
        function getValue(){
                return $this->value;}
        function setValue($value){
                $this->value = $value;}
}

$b = array();
$a = new A(0);
for($i = 1; $i <= 2; $i++){
        $a->setValue($i);
        $b[] = $a;}
print_r($b);

Expected result:
----------------
Array ( [0] => A Object ( [value:protected] => 1 ) [1] => A Object (
[value:protected] => 2 ) ) 

Actual result:
--------------
Array ( [0] => A Object ( [value:protected] => 2 ) [1] => A Object (
[value:protected] => 2 ) ) 

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

Reply via email to