mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Registering namespace after the parsing is too late because parsing can fail due to attributes referencing namespaces. So we have to register fake namespaces before the parsing. However, the clone operation reconciles namespaces in the wrong way, so we have to clone via an object. Closes GH-21371.
21 lines
456 B
PHP
21 lines
456 B
PHP
--TEST--
|
|
GH-21357 (XSLTProcessor works with \DOMDocument, but fails with \Dom\XMLDocument)
|
|
--EXTENSIONS--
|
|
dom
|
|
xsl
|
|
--CREDITS--
|
|
jacekkow
|
|
--FILE--
|
|
<?php
|
|
$xml = <<<'XML'
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tns="urn:myns" version="1.0">
|
|
<xsl:template match="tns:referee"/>
|
|
</xsl:stylesheet>
|
|
XML;
|
|
|
|
$dom = Dom\XMLDocument::createFromString($xml);
|
|
var_dump(new XSLTProcessor()->importStylesheet($dom));
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|