#23710 [NEW]: Handling of XML entites in set_content() is inconsistent
| From: | flying at dom dot natm dot ru | Date: | Tue, 20 May 2003 09:05:34 +0000 |
| Subject: | #23710 [NEW]: Handling of XML entites in set_content() is inconsistent | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-40014@lists.php.net to get a copy of this message | ||
From: flying at dom dot natm dot ru
Operating system: All
PHP version: 4.3.2RC3
PHP Bug Type: DOM XML related
Bug description: Handling of XML entites in set_content() is inconsistent
set_content() handles XML entities differently, depending on context. Take
a look at following example:
<?php
$xml = domxml_new_doc('1.0');
$root = $xml->append_child($xml->create_element('root'));
$root->set_content(' ');
$root->set_content(' ');
echo $xml->dumpmem();
?>
It produces following document:
<?xml version="1.0"?>
<root> &#160;</root>
Note, that first entity was determined as entity, but second - as plain
text, and hence quoted. Problem is in php_domxml.c, function
domxml_node_set_content(), around line 2734 (as for version) 1.218.2.23:
if (nodep->children) {
xmlNodeAddContentLen(nodep, content, content_len);
} else {
xmlNodeSetContentLen(nodep, content, content_len);
}
If you'll take a look into source of these functions in libxml (file
tree.c) - you will see, that xmlNodeSetContentLen() parses given content
for entities, while xmlNodeAddContentLen() - not.
--
Edit bug report at http://bugs.php.net/?id=23710&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23710&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23710&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23710&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23710&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23710&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23710&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23710&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23710&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23710&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23710&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23710&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23710&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23710&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23710&r=gnused