note 70519 added to ref.simplexml
| From: | ArnaudBienvenu at osu1 dot php dot net | Date: | Thu, 19 Oct 2006 14:35:11 +0000 |
| Subject: | note 70519 added to ref.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118758@lists.php.net to get a copy of this message | ||
As of PHP 5.1.4, trying to iterate on a non-existent node will actually create that node.
<?
$xml = simplexml_load_string('<root></root>');
foreach($xml->b as $dummy);
echo $xml->asXML();
?>
Gives :
<?xml version="1.0"?>
<root><b/></root>
You might think it is a bug, but PHP developers seam to consider it as a feature : http://bugs.php.net/bug.php?id=39164
----
Server IP: 217.174.203.10
Probable Submitter: 81.56.151.174
----
Manual Page -- http://www.php.net/manual/en/ref.simplexml.php
Edit -- https://master.php.net/note/edit/70519
Del: integrated -- https://master.php.net/note/delete/70519/integrated
Del: useless -- https://master.php.net/note/delete/70519/useless
Del: bad code -- https://master.php.net/note/delete/70519/bad+code
Del: spam -- https://master.php.net/note/delete/70519/spam
Del: non-english -- https://master.php.net/note/delete/70519/non-english
Del: in docs -- https://master.php.net/note/delete/70519/in+docs
Del: other reasons-- https://master.php.net/note/delete/70519
Reject -- https://master.php.net/note/reject/70519
Search -- https://master.php.net/manage/user-notes.php