note 105696 added to book.simplexml
| From: | phildotpetreeatgmaildotcom at osu1 dot php dot net | Date: | Thu, 08 Sep 2011 00:51:21 +0000 |
| Subject: | note 105696 added to book.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183020@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 184.33.59.64
----
Manual Page -- http://www.php.net/manual/en/book.simplexml.php
Edit -- https://master.php.net/note/edit/105696
Del: integrated -- https://master.php.net/note/delete/105696/integrated
Del: useless -- https://master.php.net/note/delete/105696/useless
Del: bad code -- https://master.php.net/note/delete/105696/bad+code
Del: spam -- https://master.php.net/note/delete/105696/spam
Del: non-english -- https://master.php.net/note/delete/105696/non-english
Del: in docs -- https://master.php.net/note/delete/105696/in+docs
Del: other reasons-- https://master.php.net/note/delete/105696
Reject -- https://master.php.net/note/reject/105696
Search -- https://master.php.net/manage/user-notes.php