note 68121 added to function.domnode-set-content
| From: | blah at pasher dot org | Date: | Thu, 13 Jul 2006 22:42:55 +0000 |
| Subject: | note 68121 added to function.domnode-set-content | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114768@lists.php.net to get a copy of this message | ||
For those transitioning to PHP5 DOM XML code, there is a gotcha with this function.
In PHP4, when you call $node->set_content($string), the $string must have special HTML characters
encoded. The method does not properly handle the "&" character, so this is required to
properly set the content
In PHP5, when you call $node->appendChild($dom->createTextNode($string)), PHP will properly
encode the "&" character without the need for HTML encoding.
Because of this, older code that is currently using htmlspecialchars() in the set_content() call
will potentially double-encode the "&" character if you keep the call to
htmlspecialchars() in the createTextNode() call.
----
Server IP: 216.194.113.175
Probable Submitter: 69.15.248.2
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.domnode-set-content.php
Edit -- http://master.php.net/note/edit/68121
Del: integrated -- http://master.php.net/note/delete/68121/integrated
Del: useless -- http://master.php.net/note/delete/68121/useless
Del: bad code -- http://master.php.net/note/delete/68121/bad+code
Del: spam -- http://master.php.net/note/delete/68121/spam
Del: non-english -- http://master.php.net/note/delete/68121/non-english
Del: in docs -- http://master.php.net/note/delete/68121/in+docs
Del: other reasons-- http://master.php.net/note/delete/68121
Reject -- http://master.php.net/note/reject/68121
Search -- http://master.php.net/manage/user-notes.php