From:             mike dot blamires at kingston-callcentres dot co dot uk
Operating system: Windows 2000
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  object attributes & array mix up

Description:
------------
When I have set a list of the objects attributes from an array, after
successfully setting all the attributes to there values (and echoing them
as they should be, set to the correct values) all the attributes take on
that last value set.

In the example below the value last set to an attribute was element 2 of
the array, the integer 4, now all attributes are set are set to 4. this is
the same if the last  attribute set was element 8, all attributes would
refer to "aJobTitle"

I believe this to be similar to bug 25957, although I was not totally sure
of the actual bug highlighted there so i reported as a seperate issue.

Reproduce code:
---------------
abstract class Person extends OwlObj {
        private $name;
        private $group;
        public function initialize() {
                $users = $this->dbQuery("SELECT fullname, group,
dateCreated, ammendedBy, dateAmmended, allowedReport, priorityReport,
description, onlinePass FROM tblUser WHERE
userID=".$_SESSION['userName']."");     
                //$users is a single dimension array filled with the SQL
results 
                print_r($users);
                echo"<br>";
                $this->$name = $users[1];
                echo "~ name: ".$this->$name."<br>";
                $this->$group = $users[2];
                echo "~ group: ".$this->$group."<br>";
                echo "[".$this->$name." ".$this->$group."]<br>";
                echo "name: ".$this->$name."<br>";
        }
}

Expected result:
----------------
Array ( [1] => aName [2] => 4 [3] => 2001-10-13 00:00:00 [4] => System [5]
=> 2003-07-22 00:00:00 [6] => 1 [7] => 1 [8] => aJobTitle [9] => password
) 
~ name: aName
~ group: 4
[aName 4]
name: aName

  

Actual result:
--------------
Array ( [1] => aName [2] => 4 [3] => 2001-10-13 00:00:00 [4] => System [5]
=> 2003-07-22 00:00:00 [6] => 1 [7] => 1 [8] => aJobTitle [9] => aPassword
) 
~ name: 4
~ group: 4
[4 4]
name: 4

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

Reply via email to