|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-01-28 14:07 UTC] cmb@php.net
-Status: Open
+Status: Suspended
-Assigned To:
+Assigned To: cmb
[2021-01-28 14:07 UTC] cmb@php.net
[2021-02-08 17:10 UTC] cmb@php.net
-Status: Suspended
+Status: Not a bug
[2021-02-08 17:10 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 16:00:02 2025 UTC |
Description: ------------ DOMNode::getNodePath() for DOMDocumentType node returns XPath value that is not valid for DOMXPath::query() Test script: --------------- <?php $html = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <!doctype html> <html></html> EOF; $dom = new \DOMDocument(); $dom->loadHTML($html); $xpath = new \DOMXPath($dom); foreach ($dom->childNodes as $cur_child_node) { if (!$cur_child_node instanceof DOMDocumentType) { continue; } $DOMDocumentType_xpath = $cur_child_node->getNodePath(); echo "\$DOMDocumentType_xpath = ".$DOMDocumentType_xpath."\n"; $nodelist = $xpath->query($DOMDocumentType_xpath); var_dump($nodelist); } Expected result: ---------------- $DOMDocumentType_xpath = /? object(DOMNodeList)#7 (1) { ["length"]=> int(1) } Actual result: -------------- $DOMDocumentType_xpath = /? PHP Warning: DOMXPath::query(): Invalid expression in test_xpath.php on line 30 bool(false)