note 105696 deleted from book.simplexml by danbrown
| From: | danbrown@php.net | Date: | Thu, 08 Sep 2011 16:19:15 +0000 |
| Subject: | note 105696 deleted from book.simplexml by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183046@lists.php.net to get a copy of this message | ||
Note Submitter: phil dot pe tree at g mail dot com
----
The code posted by xananax at yelostudio dot com has a bug in it that only surfaces when you have
duplicate nested nodes. For instance:
<?xml version="1.0" encoding="windows-1250"?>
<utility>
<status>
<sender>test@email.com</sender>
<scope>Test</scope>
<restriction/>
<note>This is a test</note>
<references>some test stuff</references>
<info>
<language>en-us</language>
<category>Do-dads</category>
<eventCode>
<valueName>test</valueName>
<value>one</value>
<valueName>tset</valueName>
<value>two</value>
</eventCode>
</info>
</status>
</utility>
<value>two</value> will generate this error:
Fatal error: [] operator not supported for strings in xmlhelper.php on line 37
His line 37 reads:
$children[$elementName][] = $value;
I dont know how to fix this but I spent considerable time on the problem and I'm now looking
for a new solution. Not a knock on xananax cause his code works really nice in normal
circumstances... just wanted to save someone else some trouble, especially since this code is all
over the net.