XML_Tree bug fix
| From: | Blair Robertson | Date: | Tue, 25 Feb 2003 03:47:37 +0000 |
| Subject: | XML_Tree bug fix | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-13813@lists.php.net to get a copy of this message | ||
Gday,
I have noticed (and fixed) a couple issues in the XML_Tree :
XML/Tree.php
- see Bug #19667 on bugs.php.net (http://bugs.php.net/bug.php?id=19667)
if the char data of a node was '0' (zero) the data wouldn't be
set. The solution was a simple change in the cdataHandler() fn
- getTreeFromString() didn't return the root node by reference,
which getTreeFromFile() does.
XML/Tree/Node.php
- Attribute values weren't having their single or double quotes escaped
- The content of the nodes wheren't having the <, >, ', " (left and
right angle brackets, single and double quotes) escaped.
Another thing that I changed was the moving of the _xml_entities() call
from the setContent() to being called in get(), this is because by
escaping the contents in setContent() - which get's called when parsing
any xml as well as when a user is creating a tree in the code - it
leave's the user with the task of unescaping the content before they
can use it outside the tree. If this doesn't make sense I can provide
an example.
Anyway the diff's for the fixes are available at
http://beta.squiz.net/~brobertson/public/xml_tree/
with the full version of the files being under the new/ dir
tell me what you think,
Blair