Skip to content

libxml2-2.14.0 will change behaviour of DOMProcessingInstruction #18486

Closed as not planned
@SjonHortensius

Description

@SjonHortensius

Description

Probably caused by php not yet passing XML_PARSE_NO_SYS_CATALOG and
XML_PARSE_CATALOG_PI - see https://gitlab.gnome.org/GNOME/libxml2/-/blob/master/NEWS?ref_type=heads

<?php

echo LIBXML_VERSION . "\n";

$doc = new DOMDocument();
$doc->loadHTML('<!DOCTYPE html><html><body><?php phpinfo();?></body></html>');

function printNodeClasses(DOMNodeList $nodeList): void
{
	foreach ($nodeList as $childNode)
	{
		echo $childNode::class . ': ' . $childNode->nodeName . "\n";
		if ($childNode->childNodes instanceof DOMNodeList)
			printNodeClasses($childNode->childNodes);
	}
}

printNodeClasses($doc->documentElement->childNodes);

Will result in this when compiled with libxml2-2.14.0+

21402
DOMElement: body
DOMComment: #comment

Instead of:

20904
DOMElement: body
DOMProcessingInstruction: php

PHP Version

irrelevant

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions