1--TEST-- 2Special operations with XSLTProcessor properties 3--EXTENSIONS-- 4xsl 5dom 6--FILE-- 7<?php 8 9$xml = new DOMDocument; 10$xml->loadXML('<?xml version="1.0"?><root><foo>hello</foo></root>'); 11 12function test() { 13 echo "Called test\n"; 14} 15 16$xsl = new DOMDocument; 17$xsl->loadXML(<<<XML 18<?xml version="1.0"?> 19<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" version="1.0"> 20 <xsl:template match="/root"> 21 <xsl:value-of select="php:function('test')"/> 22 <xsl:value-of select="//root/foo"/> 23 </xsl:template> 24</xsl:stylesheet> 25XML); 26 27echo "--- Unset cloneDocument ---\n"; 28 29$xslt = new XSLTProcessor; 30$xslt->registerPHPFunctions(); 31unset($xslt->cloneDocument); 32try { 33 $xslt->importStylesheet($xsl); 34} catch (Error $e) { 35 echo $e->getMessage(), "\n"; 36} 37 38echo "--- Unset doXInclude ---\n"; 39 40$xslt = new XSLTProcessor; 41$xslt->registerPHPFunctions(); 42unset($xslt->doXInclude); 43$xslt->importStylesheet($xsl); 44try { 45 echo $xslt->transformToXml($xml); 46} catch (Error $e) { 47 echo $e->getMessage(), "\n"; 48} 49 50echo "--- Make properties references ---\n"; 51 52$xslt = new XSLTProcessor; 53$xslt->registerPHPFunctions(); 54$clone =& $xslt->cloneDocument; 55$xinclude =& $xslt->doXInclude; 56$xslt->importStylesheet($xsl); 57echo $xslt->transformToXml($xml); 58 59?> 60--EXPECT-- 61--- Unset cloneDocument --- 62Typed property XSLTProcessor::$cloneDocument must not be accessed before initialization 63--- Unset doXInclude --- 64Typed property XSLTProcessor::$doXInclude must not be accessed before initialization 65--- Make properties references --- 66Called test 67<?xml version="1.0"?> 68hello 69