Bug #78129 [NEW]: DOMDocument removes whitespace between nodes

From: Date: Sat, 08 Jun 2019 14:31:05 +0000
Subject: Bug #78129 [NEW]: DOMDocument removes whitespace between nodes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221190@lists.php.net to get a copy of this message
From: nospam at unclassified dot de Operating system: Linux PHP version: 7.3.6 Package: *General Issues Bug Type: Bug Bug description:DOMDocument removes whitespace between nodes Description: ------------ The DOMDocument removes whitespace between HTML elements when loading and saving HTML content. This leads to wrong display of content. The bug only affects Linux, it works correctly in Windows (same version). Test script: --------------- <?php $html = '<html> <body> <p> Text </p> <lang>Logged in as</lang> <strong>user</strong> <script src="jquery-3.4.1.min.js"></script> <script src="site.js"></script> </body> </html>'; libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($html); header('Content-Type: text/plain'); echo $dom->saveHTML(); Expected result: ---------------- This is the output on Windows: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <body> <p> Text </p> <lang>Logged in as</lang> <strong>user</strong> <script src="jquery-3.4.1.min.js"></script> <script src="site.js"></script> </body> </html> Actual result: -------------- This is the output on Linux: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body> <p> Text </p> <lang>Logged in as</lang><strong>user</strong> <script src="jquery-3.4.1.min.js"></script><script src="site.js"></script></body></html> There is no space between "Logged in as" and "user". The <lang> element is a custom element that my PHP script will resolve into plain HTML. -- Edit bug report at https://bugs.php.net/bug.php?id=78129&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78129&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78129&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78129&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78129&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78129&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78129&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78129&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78129&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78129&r=support Expected behavior: https://bugs.php.net/fix.php?id=78129&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78129&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78129&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78129&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78129&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78129&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78129&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78129&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78129&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78129&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78129&r=mysqlcfg

« previous php.bugs (#221190) next »