From:             gerry dot rodman at ness-usa dot com
Operating system: win 2003
PHP version:      4CVS-2004-02-01 (stable)
PHP Bug Type:     XML related
Bug description:  simplexml object updating array entry not working

Description:
------------
I cant seem to change the value of an array entry in a simple xml object
if I use a variable for an index.
But it changes OK if I use a constant.


Reproduce code:
---------------
<?php
$xmlstr =
"<root><people><name>gerry</name><name>barbara</name></people></root>";
$xml = simplexml_load_string($xmlstr);
$i = 0;
$xml->people->name[$i] = "gerry changed";  // sorry, gerry doesnt change
if variable is used as index (bug?)
echo $xml->people->name[0];
echo "<br>";
$xml->people->name[0] = "gerry changed";  // gerry does change is a
constant is supplied
echo $xml->people->name[0];

?> 


Expected result:
----------------
gerry changed 
gerry changed 



Actual result:
--------------
gerry
gerry changed 
<the first gerry should be gerry changed>

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

Reply via email to