From:             php at peterrobins dot co dot uk
Operating system: Linux 2.4
PHP version:      5.0.0
PHP Bug Type:     SimpleXML related
Bug description:  Incomplete/inconsistent functionality

Description:
------------
According to the manual page, you can add a node with 
SimpleXML, but this does not seem to work, either as  
$xml->movie[0]->characters[0]->character[0]->age = '21'; 
nor as 
$xml->movie[0]->rating[2] = 'not bad'; 
 
Deletion works on attributes 
unset($xml->movie[0]->rating[1]['type']); 
but at node level, deletes all  
unset($xml->movie[0]->rating); 
This is inconsistent with reading where 
$xml->movie[0]->rating 
fetches the first node only. 
unset($xml->movie->rating); 
deletes all ratings for the 1st movie only. 
It does not appear possible to delete just 1 node 
unset($xml->movie[0]->rating[1]); 
 
Because objs are now refs not copies, can do this 
$rat = $xml->movie[0]->rating[0]; 
$rat['name'] = 'judge'; 
but not this 
$rat = 'new content'; 
nor this 
$rat->child[0] = 'new rating'; 
and if I try and do 
$rat->child = 'new rating'; 
I get 'Attempt to assign property of non-object' 
 


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

Reply via email to