|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-02-22 00:26 UTC] morozov at tut dot by
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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
Windows vs. Linux is irrelevant here; the behavior is different for different versions of libxml2; libxml2 2.9.10 on Linux also reports int(3) int(3) So this is an upstream issue, but not a PHP bug.