#49984 [NEW]: DOM node contains partial contents only

From: Date: Sat, 24 Oct 2009 04:27:57 +0000
Subject: #49984 [NEW]: DOM node contains partial contents only
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143895@lists.php.net to get a copy of this message
From: ppass at hotmail dot fr Operating system: Linux ns1 2.6.28.4-rsbac PHP version: 5.2.11 PHP Bug Type: DOM XML related Bug description: DOM node contains partial contents only 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. -- Edit bug report at http://bugs.php.net/?id=49984&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49984&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49984&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49984&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49984&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49984&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49984&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49984&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49984&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49984&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49984&r=support Expected behavior: http://bugs.php.net/fix.php?id=49984&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49984&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49984&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49984&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49984&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49984&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49984&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49984&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49984&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49984&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49984&r=mysqlcfg

« previous php.bugs (#143895) next »