|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-13 07:29 UTC] ab@php.net
-Status: Open
+Status: Not a bug
[2016-04-13 07:29 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Description: ------------ DOMDocument::loadHTML() stops processing the source string after a null byte (U+0000) without issuing any exception or warning. I have tested that this happens in PHP versions 5.5.34, 5.6.20 and 7.0.5. Test script: --------------- <?php $html = <<<EOD <!DOCTYPE html> <html> <div>Pre NULL byte</div> \0 <div>Post NULL byte</div> </html> EOD; $dom = new \DOMDocument('1.0'); $dom->validateOnParse = true; $dom->loadHTML($html); echo $dom->saveHTML(); Expected result: ---------------- <!DOCTYPE html> <html><body><div>Pre NULL byte</div> <div>Post NULL byte</div> </body></html> Actual result: -------------- <!DOCTYPE html> <html><body><div>Pre NULL byte</div></body></html>