mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
* Define doXInclude for XSLTProcessor, and test the property This was added in8d1427dd98, but never defined on the stub. It was more or less fine when dynamic properties were not deprecated, but now they throw a deprecation warning. To fix it, define on the stub. This should also help discoverability of the functionality. * Define cloneDocument for XSLTProcessor, and test the property This was introduced in5c039bbad9, but never defined on the stub. It was more or less fine when dynamic properties were not deprecated, but now they throw a deprecation warning. To fix it, define on the stub. This should also help discoverability of the functionality.
46 lines
983 B
PHP
46 lines
983 B
PHP
--TEST--
|
|
cloneDocument
|
|
--EXTENSIONS--
|
|
xsl
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
|
|
$xml = new DOMDocument;
|
|
$xml->loadXML('<?xml version="1.0"?><root><foo>hello</foo></root>');
|
|
|
|
function test() {
|
|
global $xml;
|
|
$xml->documentElement->firstChild->textContent = "bye";
|
|
}
|
|
|
|
$xsl = new DOMDocument;
|
|
$xsl->loadXML(<<<XML
|
|
<?xml version="1.0"?>
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" version="1.0">
|
|
<xsl:template match="/root">
|
|
<xsl:value-of select="php:function('test')"/>
|
|
<xsl:value-of select="//root/foo"/>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|
|
XML);
|
|
|
|
$xslt = new XSLTProcessor;
|
|
$xslt->registerPHPFunctions();
|
|
$xslt->cloneDocument = true;
|
|
$xslt->importStylesheet($xsl);
|
|
echo $xslt->transformToXml($xml);
|
|
|
|
$xslt = new XSLTProcessor;
|
|
$xslt->registerPHPFunctions();
|
|
$xslt->cloneDocument = false;
|
|
$xslt->importStylesheet($xsl);
|
|
echo $xslt->transformToXml($xml);
|
|
|
|
?>
|
|
--EXPECT--
|
|
<?xml version="1.0"?>
|
|
hello
|
|
<?xml version="1.0"?>
|
|
bye
|