|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-02 05:42 UTC] ppass at hotmail dot fr
[2009-11-02 06:53 UTC] rasmus@php.net
[2009-11-02 13:46 UTC] ppass at hotmail dot fr
[2009-11-02 17:45 UTC] ppass at hotmail dot fr
[2009-11-04 09:42 UTC] ppass at hotmail dot fr
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 22:00:02 2025 UTC |
Description: ------------ The script node's parent is a div. The script node has the text '</div>' inside its script. The DOM node returns only partial contents of the script node, as if the node was mistakenly truncated when reaching the '</div>' text. Reproduce code: --------------- $html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title>Title</title></head><body><div><script type="text/javascript" id="script1">function dummy { object.innerHTML="<div>text</div>"; } function dummy2 { alert("hello"); } </script> </div> </body> </html>'; $dom = new DOMDocument('1.0', 'UTF-8'); @$dom->loadHTML($html); $script_node = $dom->getElementById('script1'); Echo "<![CDATA[$script_node->nodeValue]]>"; Expected result: ---------------- function dummy { object.innerHTML="<div>text</div>"; } function dummy2 { alert("hello"); } I expect to see the whole content of the script node. Actual result: -------------- function dummy { object.innerHTML="<div>text The script node has been truncated.