#41584 [Opn->Fbk]: SimpleXML emits wrong spurious notice...
| From: | tony2001@php.net | Date: | Mon, 04 Jun 2007 11:12:37 +0000 |
| Subject: | #41584 [Opn->Fbk]: SimpleXML emits wrong spurious notice... | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113343@lists.php.net to get a copy of this message | ||
ID: 41584
Updated by: tony2001@php.net
Reported By: judas dot iscariote at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: SimpleXML related
Operating System: any
PHP Version: 5CVS-2007-06-04 (CVS)
New Comment:
IMO the warning is correct and the code is not.
I don't understand what you're trying to do with $object[0]->property -
is this supposed to created a property named '0' and assign an empty
object to it?
Previous Comments:
------------------------------------------------------------------------
[2007-06-04 10:09:37] judas dot iscariote at gmail dot com
Description:
------------
[different problem, but a follow up of bug 41582
The following code emits a wrong notice, rendering this stuff more or
less useless in write context...
Reproduce code:
---------------
<?php
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?>
<collection></collection>');
$xml->movie[0]->characters->character[0]->name = 'Miss Coder';
$xml->movie[0]->characters->character[1]->name = 'ouch';
var_dump($xml->asXML());
Expected result:
----------------
string(%d) "<?xml version="1.0" standalone="yes"?>
<collection><movie><characters><character><name>Miss
Coder</name></character><character><name>ouch</name></character></characters></movie></collection>
"
Actual result:
--------------
PHP Notice: Indirect modification of overloaded element of
SimpleXMLElement has no effect in /home/cristian/simplecrashes.php on
line 6
string(151) "<?xml version="1.0" standalone="yes"?>
<collection><movie><characters><character><name>Miss
Coder</name></character></characters></movie></collection>
"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41584&edit=1