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