Bug #77651 [NEW]: DOMDocument preserves insignificant whitespace text nodes
| From: | morozov at tut dot by | Date: | Fri, 22 Feb 2019 00:26:11 +0000 |
| Subject: | Bug #77651 [NEW]: DOMDocument preserves insignificant whitespace text nodes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219688@lists.php.net to get a copy of this message | ||
From: morozov at tut dot by
Operating system: Windows
PHP version: 7.3.2
Package: DOM XML related
Bug Type: Bug
Bug description:DOMDocument preserves insignificant whitespace text nodes
Description:
------------
DOMDocument::loadHTML() produces different results on Windows and Linux.
Whitespace text nodes are ignored between non-inline elements on Linux
but not on Windows.
The different behaviors are observed on the same PHP version (7.3.2) and
very close libxml versions (2.9.3 on Linux and 2.9.8 on Windows).
Test script:
---------------
$doc = new DOMDocument();
$doc->loadHTML(
<<<HTML
<html>
<body>
<map>
<area />
</map>
<div>
<span />
</div>
</body>
</html>
HTML
);
var_dump(
$doc->getElementsByTagName('map')
->item(0)
->childNodes
->length
);
var_dump(
$doc->getElementsByTagName('div')
->item(0)
->childNodes
->length
);
Expected result:
----------------
int(1)
int(3)
Actual result:
--------------
int(3)
int(3)
--
Edit bug report at https://bugs.php.net/bug.php?id=77651&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77651&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77651&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77651&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77651&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77651&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77651&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77651&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77651&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77651&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77651&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77651&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77651&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77651&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77651&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77651&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77651&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77651&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77651&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77651&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77651&r=mysqlcfg