[php-src] Issue #22219: [DOM] Dom\XMLDocument::schemaValidate fails to resolve xs:QName with prefix from imported schema (works in DOMDocument)

From: Date: Wed, 03 Jun 2026 19:51:52 +0000
Subject: [php-src] Issue #22219: [DOM] Dom\XMLDocument::schemaValidate fails to resolve xs:QName with prefix from imported schema (works in DOMDocument)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252161@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/22219 Author: tvdijen ### Description The following code: ```php <?php $xmlString = file_get_contents(__DIR__ . '/test.wsdl'); echo "=== Testing with new Dom\\XMLDocument (PHP 8.4+) ===\n\n"; testValidation("Direct custom.xsd", $xmlString, __DIR__ . '/custom.xsd', true); echo "\n=== Testing with old DOMDocument (for comparison) ===\n\n"; testValidation("Direct custom.xsd", $xmlString, __DIR__ . '/custom.xsd', false); function testValidation(string $name, string $xmlString, string $xsdPath, bool $useNewDom): void { libxml_use_internal_errors(true); libxml_clear_errors(); if ($useNewDom) { $doc = Dom\XMLDocument::createFromString($xmlString, LIBXML_NSCLEAN); $valid = $doc->schemaValidate($xsdPath); } else { $doc = new DOMDocument(); $doc->loadXML($xmlString, LIBXML_NSCLEAN); $valid = $doc->schemaValidate($xsdPath); } echo "[$name] " . ($useNewDom ? "Dom\\XMLDocument" : "DOMDocument") . " → "; if ($valid) { echo "✓ VALID\n"; } else { echo "✗ INVALID\n"; foreach (libxml_get_errors() as $error) { echo " Line {$error->line}: {$error->message}\n"; } libxml_clear_errors(); } } ``` Resulted in this output: ``` === Testing with new Dom\XMLDocument (PHP 8.4+) === [Direct custom.xsd] Dom\XMLDocument → ✗ INVALID Line 9: Element '{http://schemas.xmlsoap.org/wsdl/}part', attribute 'element': The QName value 'ssp:CustomElement' has no corresponding namespace declaration in scope. Line 9: Element '{http://schemas.xmlsoap.org/wsdl/}part', attribute 'element': 'ssp:CustomElement' is not a valid value of the atomic type 'xs:QName'. === Testing with old DOMDocument (for comparison) === [Direct custom.xsd] DOMDocument → ✓ VALID ``` But I expected this output instead: ``` === Testing with new Dom\XMLDocument (PHP 8.4+) === [Direct custom.xsd] Dom\XMLDocument → ✓ VALID === Testing with old DOMDocument (for comparison) === [Direct custom.xsd] DOMDocument → ✓ VALID ``` ### PHP Version ```plain PHP 8.4.21 (cli) (built: May 5 2026 16:34:12) (NTS gcc x86_64) Copyright (c) The PHP Group Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine Zend Engine v4.4.21, Copyright (c) Zend Technologies with Zend OPcache v8.4.21, Copyright (c), by Zend Technologies PHP 8.5.6 (cli) (built: May 5 2026 21:19:36) (NTS gcc x86_64) Copyright (c) The PHP Group Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine Zend Engine v4.5.6, Copyright (c) Zend Technologies with Zend OPcache v8.5.6, Copyright (c), by Zend Technologies ``` ### Operating System Centos 9

« previous php.bugs (#252161) next »