summaryrefslogtreecommitdiff
path: root/ext/xsl/tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/xsl/tests
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/xsl/tests')
-rw-r--r--ext/xsl/tests/area_list.xsl10
-rw-r--r--ext/xsl/tests/area_name.xml12
-rw-r--r--ext/xsl/tests/bug26384.phpt33
-rw-r--r--ext/xsl/tests/bug33853.phpt33
-rw-r--r--ext/xsl/tests/bug48221.phpt17
-rw-r--r--ext/xsl/tests/bug54446.phpt95
-rw-r--r--ext/xsl/tests/bug54446_with_ini.phpt135
-rw-r--r--ext/xsl/tests/documentxpath.xsl10
-rw-r--r--ext/xsl/tests/exslt.xml15
-rw-r--r--ext/xsl/tests/exslt.xsl45
-rw-r--r--ext/xsl/tests/phpfunc-nostring.xsl10
-rw-r--r--ext/xsl/tests/phpfunc-undef.xsl10
-rw-r--r--ext/xsl/tests/phpfunc.xsl11
-rw-r--r--ext/xsl/tests/prepare.inc20
-rw-r--r--ext/xsl/tests/skipif.inc1
-rw-r--r--ext/xsl/tests/streamsinclude.xsl6
-rw-r--r--ext/xsl/tests/xsl-phpinfo.phpt18
-rw-r--r--ext/xsl/tests/xslt.xml28
-rw-r--r--ext/xsl/tests/xslt.xsl26
-rw-r--r--ext/xsl/tests/xslt.xsl.gzbin0 -> 395 bytes
-rw-r--r--ext/xsl/tests/xslt001.phpt22
-rw-r--r--ext/xsl/tests/xslt002.phpt29
-rw-r--r--ext/xsl/tests/xslt003.phpt23
-rw-r--r--ext/xsl/tests/xslt004.phpt29
-rw-r--r--ext/xsl/tests/xslt005.phpt31
-rw-r--r--ext/xsl/tests/xslt006.phpt23
-rw-r--r--ext/xsl/tests/xslt007.phpt24
-rw-r--r--ext/xsl/tests/xslt008.phpt31
-rw-r--r--ext/xsl/tests/xslt009.phpt28
-rw-r--r--ext/xsl/tests/xslt010.phpt206
-rw-r--r--ext/xsl/tests/xslt011.phpt59
-rw-r--r--ext/xsl/tests/xslt011.xml1
-rw-r--r--ext/xsl/tests/xslt011.xsl25
-rw-r--r--ext/xsl/tests/xslt012.phpt52
-rw-r--r--ext/xsl/tests/xslt012.xsl29
-rw-r--r--ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt17
-rw-r--r--ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt26
-rw-r--r--ext/xsl/tests/xsltprocessor_getParameter.phpt19
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt30
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt34
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt28
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt26
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt31
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt30
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt32
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt32
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt28
-rw-r--r--ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt26
-rw-r--r--ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt18
-rw-r--r--ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt23
-rw-r--r--ext/xsl/tests/xsltprocessor_removeParameter.phpt20
-rw-r--r--ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt21
-rw-r--r--ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt22
53 files changed, 1610 insertions, 0 deletions
diff --git a/ext/xsl/tests/area_list.xsl b/ext/xsl/tests/area_list.xsl
new file mode 100644
index 0000000..e0c88c6
--- /dev/null
+++ b/ext/xsl/tests/area_list.xsl
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="text" encoding="UTF-8"/>
+
+ <xsl:key name="area" match="ROW" use="substring(translate(AREA_NAME, '&quot;', ''), 1, 1)"/>
+<xsl:template match="*">
+ HERE
+</xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/area_name.xml b/ext/xsl/tests/area_name.xml
new file mode 100644
index 0000000..76cea58
--- /dev/null
+++ b/ext/xsl/tests/area_name.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<AREA_NAME>
+ <ROW>
+ <AREA_CODE>13</AREA_CODE>
+ <AREA_NAME>&quot;Автово&quot; м.</AREA_NAME>
+ <AREA_NAME_ENG>m.&quot;Avtovo&quot;</AREA_NAME_ENG>
+ </ROW>
+</AREA_NAME>
+
+
+
diff --git a/ext/xsl/tests/bug26384.phpt b/ext/xsl/tests/bug26384.phpt
new file mode 100644
index 0000000..e415ec9
--- /dev/null
+++ b/ext/xsl/tests/bug26384.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #26384 (domxslt->process causes segfault with xsl:key)
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+$dom = new domDocument;
+$dom->load(dirname(__FILE__)."/area_name.xml");
+if(!$dom) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+$xsl = new domDocument;
+$xsl->load(dirname(__FILE__)."/area_list.xsl");
+if(!$xsl) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+$proc = new xsltprocessor;
+if(!$proc) {
+ echo "Error while making xsltprocessor object\n";
+ exit;
+}
+
+$proc->importStylesheet($xsl);
+print $proc->transformToXml($dom);
+
+//this segfaulted before
+print $dom->documentElement->firstChild->nextSibling->nodeName;
+
+--EXPECT--
+HERE
+ROW
diff --git a/ext/xsl/tests/bug33853.phpt b/ext/xsl/tests/bug33853.phpt
new file mode 100644
index 0000000..bcf30f6
--- /dev/null
+++ b/ext/xsl/tests/bug33853.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #33853 (php:function call __autoload with lowercase param)
+--SKIPIF--
+<?php if (!extension_loaded('xsl')) die('skip xsl not loaded'); ?>
+--FILE--
+<?php
+
+function __autoload($className) {
+ var_dump($className);
+ exit();
+}
+
+$xsl = new DomDocument();
+$xsl->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:php="http://php.net/xsl">
+<xsl:template match="/">
+<xsl:value-of select="php:function(\'TeSt::dateLang\')" />
+</xsl:template>
+</xsl:stylesheet>');
+$inputdom = new DomDocument();
+$inputdom->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
+<today></today>');
+
+$proc = new XsltProcessor();
+$proc->registerPhpFunctions();
+$xsl = $proc->importStylesheet($xsl);
+$newdom = $proc->transformToDoc($inputdom);
+?>
+===DONE===
+--EXPECT--
+string(4) "TeSt"
diff --git a/ext/xsl/tests/bug48221.phpt b/ext/xsl/tests/bug48221.phpt
new file mode 100644
index 0000000..2d08b3d
--- /dev/null
+++ b/ext/xsl/tests/bug48221.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #48221 (memory leak when passing invalid xslt parameter)
+--SKIPIF--
+<?php
+if (!extension_loaded('xsl')) die("skip Extension XSL is required\n");
+?>
+--FILE--
+<?php
+include('prepare.inc');
+$proc->importStylesheet($xsl);
+$proc->setParameter('', '', '"\'');
+$proc->transformToXml($dom);
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml(): Cannot create XPath expression (string contains both quote and double-quotes) in %s on line %d
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/bug54446.phpt b/ext/xsl/tests/bug54446.phpt
new file mode 100644
index 0000000..f00b118
--- /dev/null
+++ b/ext/xsl/tests/bug54446.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Bug #54446 (Arbitrary file creation via libxslt 'output' extension)
+--SKIPIF--
+<?php
+if (!extension_loaded('xsl')) die("skip Extension XSL is required\n");
+?>
+--FILE--
+<?php
+include("prepare.inc");
+
+$outputfile = dirname(__FILE__)."/bug54446test.txt";
+if (file_exists($outputfile)) {
+ unlink($outputfile);
+}
+
+$sXsl = <<<EOT
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:sax="http://icl.com/saxon"
+ extension-element-prefixes="sax">
+
+ <xsl:template match="/">
+ <sax:output href="$outputfile" method="text">
+ <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/>
+ </sax:output>
+ </xsl:template>
+
+</xsl:stylesheet>
+EOT;
+
+$xsl->loadXML( $sXsl );
+
+# START XSLT
+$proc->importStylesheet( $xsl );
+
+# TRASNFORM & PRINT
+print $proc->transformToXML( $dom );
+
+
+if (file_exists($outputfile)) {
+ print "$outputfile exists, but shouldn't!\n";
+} else {
+ print "OK, no file created\n";
+}
+
+#SET NO SECURITY PREFS
+$proc->setSecurityPrefs(XSL_SECPREF_NONE);
+
+# TRASNFORM & PRINT
+print $proc->transformToXML( $dom );
+
+
+if (file_exists($outputfile)) {
+ print "OK, file exists\n";
+} else {
+ print "$outputfile doesn't exist, but should!\n";
+}
+
+unlink($outputfile);
+
+#SET SECURITY PREFS AGAIN
+$proc->setSecurityPrefs( XSL_SECPREF_WRITE_FILE | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY);
+
+# TRASNFORM & PRINT
+print $proc->transformToXML( $dom );
+
+if (file_exists($outputfile)) {
+ print "$outputfile exists, but shouldn't!\n";
+} else {
+ print "OK, no file created\n";
+}
+
+
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): File write for %s/bug54446test.txt refused in %s on line %s
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
+OK, no file created
+OK, file exists
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): File write for %s/bug54446test.txt refused in %s on line %s
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
+OK, no file created
+--CREDITS--
+Christian Stocker, chregu@php.net
+
diff --git a/ext/xsl/tests/bug54446_with_ini.phpt b/ext/xsl/tests/bug54446_with_ini.phpt
new file mode 100644
index 0000000..fbe0365
--- /dev/null
+++ b/ext/xsl/tests/bug54446_with_ini.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Bug #54446 (Arbitrary file creation via libxslt 'output' extension with php.ini setting)
+--SKIPIF--
+<?php
+if (!extension_loaded('xsl')) die("skip Extension XSL is required\n");
+?>
+--FILE--
+<?php
+include("prepare.inc");
+
+$outputfile = dirname(__FILE__)."/bug54446test.txt";
+if (file_exists($outputfile)) {
+ unlink($outputfile);
+}
+
+$sXsl = <<<EOT
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:sax="http://icl.com/saxon"
+ extension-element-prefixes="sax">
+
+ <xsl:template match="/">
+ <sax:output href="$outputfile" method="text">
+ <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/>
+ </sax:output>
+ </xsl:template>
+
+</xsl:stylesheet>
+EOT;
+
+$xsl->loadXML( $sXsl );
+
+# START XSLT
+$proc->importStylesheet( $xsl );
+
+# TRASNFORM & PRINT
+print $proc->transformToXML( $dom );
+
+
+if (file_exists($outputfile)) {
+ print "$outputfile exists, but shouldn't!\n";
+} else {
+ print "OK, no file created\n";
+}
+
+#SET NO SECURITY PREFS
+ini_set("xsl.security_prefs", XSL_SECPREF_NONE);
+
+# TRASNFORM & PRINT
+print $proc->transformToXML( $dom );
+
+
+if (file_exists($outputfile)) {
+ print "OK, file exists\n";
+} else {
+ print "$outputfile doesn't exist, but should!\n";
+}
+
+unlink($outputfile);
+
+#SET SECURITY PREFS AGAIN
+ini_set("xsl.security_prefs", XSL_SECPREF_WRITE_FILE | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY);
+
+# TRASNFORM & PRINT
+print $proc->transformToXML( $dom );
+
+if (file_exists($outputfile)) {
+ print "$outputfile exists, but shouldn't!\n";
+} else {
+ print "OK, no file created\n";
+}
+
+#SET NO SECURITY PREFS with ini, but set them with ->setSecurityPrefs
+ini_set("xsl.security_prefs", XSL_SECPREF_NONE);
+$proc->setSecurityPrefs( XSL_SECPREF_WRITE_FILE | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY);
+
+print $proc->transformToXML( $dom );
+if (file_exists($outputfile)) {
+ print "$outputfile exists, but shouldn't!\n";
+} else {
+ print "OK, no file created\n";
+}
+
+#don't throw a warning if both ini and through-the-method have the same value
+$proc->setSecurityPrefs(XSL_SECPREF_NONE);
+
+print $proc->transformToXML( $dom );
+
+if (file_exists($outputfile)) {
+ print "OK, file exists\n";
+} else {
+ print "$outputfile doesn't exist, but should!\n";
+}
+unlink($outputfile);
+
+
+
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): File write for %s/bug54446test.txt refused in %s on line %s
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
+OK, no file created
+
+Deprecated: XSLTProcessor::transformToXml(): The xsl.security_prefs php.ini option is deprecated; use XsltProcessor->setSecurityPrefs() instead in %s on line %d
+OK, file exists
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): File write for %s/bug54446test.txt refused in %s on line %s
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
+OK, no file created
+
+Deprecated: XSLTProcessor::transformToXml(): The xsl.security_prefs php.ini option is deprecated; use XsltProcessor->setSecurityPrefs() instead in %s on line %d
+
+Notice: XSLTProcessor::transformToXml(): The xsl.security_prefs php.ini was not used, since the XsltProcessor->setSecurityPrefs() method was used in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %s element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): File write for %s/bug54446test.txt refused in %s on line %s
+
+Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d element output in %s on line %d
+
+Warning: XSLTProcessor::transformToXml(): xsltDocumentElem: write rights for %s/bug54446test.txt denied in %s on line %d
+OK, no file created
+OK, file exists
+--CREDITS--
+Christian Stocker, chregu@php.net
+
diff --git a/ext/xsl/tests/documentxpath.xsl b/ext/xsl/tests/documentxpath.xsl
new file mode 100644
index 0000000..0e5c5c1
--- /dev/null
+++ b/ext/xsl/tests/documentxpath.xsl
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: documentxpath.xsl,v 1.1 2003-10-27 15:12:20 chregu Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+ <xsl:output method="xml" encoding="iso-8859-1" indent="no"/>
+<xsl:template match="/">
+
+<xsl:value-of select="document('compress.zlib://ext/xsl/tests/xslt.xsl.gz')/xsl:stylesheet/xsl:param/@name"/>
+</xsl:template>
+
+ </xsl:stylesheet>
diff --git a/ext/xsl/tests/exslt.xml b/ext/xsl/tests/exslt.xml
new file mode 100644
index 0000000..562e08e
--- /dev/null
+++ b/ext/xsl/tests/exslt.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<page>
+ <!-- valid xs:date -->
+ <date date="0001-12-31Z"/>
+ <date date="3000-01-31"/>
+ <date date="2000-02-29"/>
+ <date date="9990001-12-31Z"/>
+ <date date="-0004-02-29"/>
+ <date date="1999-01-02"/>
+ <date date="1999-01-03"/>
+ <date date="2004-01-01"/>
+ <date date="2006-01-01"/>
+ <date date="2007-12-31"/>
+</page>
+
diff --git a/ext/xsl/tests/exslt.xsl b/ext/xsl/tests/exslt.xsl
new file mode 100644
index 0000000..8f0baef
--- /dev/null
+++ b/ext/xsl/tests/exslt.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:date="http://exslt.org/dates-and-times"
+ extension-element-prefixes="date">
+
+<xsl:output method="text"/>
+
+<xsl:template match="date">
+ Test Date : <xsl:value-of select="@date"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ year : <xsl:value-of select="date:year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gYear; else NaN -->
+ leap-year : <xsl:value-of select="date:leap-year(@date)"/>
+ <!-- dateTime, date, gYearMonth, gMonth or gMonthDay; else NaN -->
+ month-in-year : <xsl:value-of select="date:month-in-year(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-name : <xsl:value-of select="date:month-name(@date)"/>
+ <!-- dateTime, date, gYearMonth or gMonth; else '' -->
+ month-abbreviation : <xsl:value-of select="date:month-abbreviation(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ week-in-year : <xsl:value-of select="date:week-in-year(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-year : <xsl:value-of select="date:day-in-year(@date)"/>
+ <!-- dateTime, date, gMonthDay or gDay; else NaN -->
+ day-in-month : <xsl:value-of select="date:day-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-of-week-in-month : <xsl:value-of select="date:day-of-week-in-month(@date)"/>
+ <!-- dateTime, date; else NaN -->
+ day-in-week : <xsl:value-of select="date:day-in-week(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-name : <xsl:value-of select="date:day-name(@date)"/>
+ <!-- dateTime or date; else NaN -->
+ day-abbreviation : <xsl:value-of select="date:day-abbreviation(@date)"/>
+ <!-- dateTime or time; else '' -->
+ time : <xsl:value-of select="date:time(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ hour-in-day : <xsl:value-of select="date:hour-in-day(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ minute-in-hour : <xsl:value-of select="date:minute-in-hour(@date)"/>
+ <!-- dateTime or time; else NaN -->
+ second-in-minute : <xsl:value-of select="date:second-in-minute(@date)"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/phpfunc-nostring.xsl b/ext/xsl/tests/phpfunc-nostring.xsl
new file mode 100644
index 0000000..f278faf
--- /dev/null
+++ b/ext/xsl/tests/phpfunc-nostring.xsl
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: phpfunc-nostring.xsl,v 1.1.2.2 2009-05-23 14:49:55 felipe Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl"
+>
+ <xsl:output method="text" encoding="iso-8859-1" indent="no"/>
+ <xsl:template match="/">
+ <xsl:value-of select="php:function(123,'this is an example')"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/phpfunc-undef.xsl b/ext/xsl/tests/phpfunc-undef.xsl
new file mode 100644
index 0000000..e05b03b
--- /dev/null
+++ b/ext/xsl/tests/phpfunc-undef.xsl
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: phpfunc-undef.xsl,v 1.1.2.2 2009-05-23 14:49:55 felipe Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl"
+>
+ <xsl:output method="text" encoding="iso-8859-1" indent="no"/>
+ <xsl:template match="/">
+ <xsl:value-of select="php:function('undefinedfunc','this is an example')"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/phpfunc.xsl b/ext/xsl/tests/phpfunc.xsl
new file mode 100644
index 0000000..3031ab7
--- /dev/null
+++ b/ext/xsl/tests/phpfunc.xsl
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: phpfunc.xsl,v 1.1.2.2 2009-05-23 14:49:55 felipe Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl"
+>
+ <xsl:output method="text" encoding="iso-8859-1" indent="no"/>
+<!-- <xsl:param name="foo" select="'bar'"/>-->
+ <xsl:template match="/">
+ <xsl:value-of select="php:function('ucwords','this is an example')"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/prepare.inc b/ext/xsl/tests/prepare.inc
new file mode 100644
index 0000000..bd5bbee
--- /dev/null
+++ b/ext/xsl/tests/prepare.inc
@@ -0,0 +1,20 @@
+<?php
+$dom = new domDocument;
+$dom->load(dirname(__FILE__)."/xslt.xml");
+if(!$dom) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+$xsl = new domDocument;
+$xsl->load(dirname(__FILE__)."/xslt.xsl");
+if(!$xsl) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+$proc = new xsltprocessor;
+if(!$proc) {
+ echo "Error while making xsltprocessor object\n";
+ exit;
+}
+
+?>
diff --git a/ext/xsl/tests/skipif.inc b/ext/xsl/tests/skipif.inc
new file mode 100644
index 0000000..0ef7372
--- /dev/null
+++ b/ext/xsl/tests/skipif.inc
@@ -0,0 +1 @@
+<?php if (!extension_loaded('xsl')) die('skip xsl extension not available');?>
diff --git a/ext/xsl/tests/streamsinclude.xsl b/ext/xsl/tests/streamsinclude.xsl
new file mode 100644
index 0000000..6f8bc40
--- /dev/null
+++ b/ext/xsl/tests/streamsinclude.xsl
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: streamsinclude.xsl,v 1.1 2003-10-27 15:12:20 chregu Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+ <xsl:output method="xml" encoding="iso-8859-1" indent="no"/>
+ <xsl:include href="compress.zlib://xslt.xsl.gz"/>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/xsl-phpinfo.phpt b/ext/xsl/tests/xsl-phpinfo.phpt
new file mode 100644
index 0000000..83e6729
--- /dev/null
+++ b/ext/xsl/tests/xsl-phpinfo.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test phpinfo() displays xsl info
+--SKIPIF--
+<?php
+ if (!extension_loaded("xsl")) {
+ die("SKIP extension gettext not loaded\n");
+ }
+?>
+--FILE--
+<?php
+phpinfo();
+?>
+--EXPECTF--
+%a
+libxslt compiled against libxml Version%a
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xslt.xml b/ext/xsl/tests/xslt.xml
new file mode 100644
index 0000000..b0e9506
--- /dev/null
+++ b/ext/xsl/tests/xslt.xml
@@ -0,0 +1,28 @@
+<?xml version='1.0' encoding="iso-8859-1" ?>
+<chapter language="en">
+ <title language="en">Title</title>
+ <para language="ge">
+
+<!-- comment -->
+ <informaltable>
+ <tgroup cols="3">
+ <tbody>
+ <row>
+ <entry>a1</entry>
+ <entry morerows="1">b1</entry>
+ <entry>c1</entry>
+ </row>
+ <row>
+ <entry>a2</entry>
+ <entry>c2</entry>
+ </row>
+ <row>
+ <entry>3</entry>
+ <entry>b3</entry>
+ <entry>c3</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+</chapter>
diff --git a/ext/xsl/tests/xslt.xsl b/ext/xsl/tests/xslt.xsl
new file mode 100644
index 0000000..8331ccc
--- /dev/null
+++ b/ext/xsl/tests/xslt.xsl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: xslt.xsl,v 1.2 2003-11-29 13:01:19 chregu Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+
+ <xsl:output method="xml" encoding="iso-8859-1" indent="no"/>
+ <xsl:param name="foo" select="'bar'"/>
+ <xsl:template match="/">
+ <html>
+ <body>
+ <xsl:value-of select="$foo"/><xsl:text>
+</xsl:text>
+ <xsl:apply-templates select="/chapter/para/informaltable/tgroup/tbody/row"/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="row">
+ <xsl:for-each select="entry">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ <br/> <xsl:text>
+</xsl:text>
+
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/xslt.xsl.gz b/ext/xsl/tests/xslt.xsl.gz
new file mode 100644
index 0000000..910bb63
--- /dev/null
+++ b/ext/xsl/tests/xslt.xsl.gz
Binary files differ
diff --git a/ext/xsl/tests/xslt001.phpt b/ext/xsl/tests/xslt001.phpt
new file mode 100644
index 0000000..ec5538a
--- /dev/null
+++ b/ext/xsl/tests/xslt001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test 1: Transform To XML String
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 1: Transform To XML String";
+include("prepare.inc");
+$proc->importStylesheet($xsl);
+print "\n";
+print $proc->transformToXml($dom);
+print "\n";
+
+
+--EXPECT--
+Test 1: Transform To XML String
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html><body>bar
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt002.phpt b/ext/xsl/tests/xslt002.phpt
new file mode 100644
index 0000000..5ce2eb9
--- /dev/null
+++ b/ext/xsl/tests/xslt002.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test 2: Transform To HTML String
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 2: Transform To HTML String";
+include("prepare.inc");
+// changing output method to html
+$xp = new domxpath($xsl);
+$res = $xp->query("/xsl:stylesheet/xsl:output/@method");
+if ($res->length != 1) {
+ print "No or more than one xsl:output/@method found";
+ exit;
+}
+$res->item(0)->value = "html";
+$proc->importStylesheet($xsl);
+print "\n";
+print $proc->transformToXml($dom);
+print "\n";
+
+
+--EXPECT--
+Test 2: Transform To HTML String
+<html><body>bar
+a1 b1 c1 <br>
+a2 c2 <br>
+3 b3 c3 <br>
+</body></html>
diff --git a/ext/xsl/tests/xslt003.phpt b/ext/xsl/tests/xslt003.phpt
new file mode 100644
index 0000000..60a8427
--- /dev/null
+++ b/ext/xsl/tests/xslt003.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test 3: Using Parameters
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 3: Using Parameters";
+include("prepare.inc");
+$proc->importStylesheet($xsl);
+$proc->setParameter( "", "foo","hello world");
+print "\n";
+print $proc->transformToXml($dom);
+print "\n";
+
+
+--EXPECT--
+Test 3: Using Parameters
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html><body>hello world
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt004.phpt b/ext/xsl/tests/xslt004.phpt
new file mode 100644
index 0000000..e543232
--- /dev/null
+++ b/ext/xsl/tests/xslt004.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test 4: Checking UTF8 Output
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 4: Checking UTF8 Output";
+include("prepare.inc");
+$xp = new domxpath($xsl);
+$res = $xp->query("/xsl:stylesheet/xsl:output/@encoding");
+if ($res->length != 1) {
+ print "No or more than one xsl:output/@encoding found";
+ exit;
+}
+$res->item(0)->value = "utf-8";
+$proc->importStylesheet($xsl);
+print "\n";
+print $proc->transformToXml($dom);
+print "\n";
+
+
+--EXPECT--
+Test 4: Checking UTF8 Output
+<?xml version="1.0" encoding="utf-8"?>
+<html><body>bar
+a1 b1 c1 <br/>
+a2 c2 <br/>
+ä3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt005.phpt b/ext/xsl/tests/xslt005.phpt
new file mode 100644
index 0000000..5492bf8
--- /dev/null
+++ b/ext/xsl/tests/xslt005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test 5: Checking Indent
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 5: Checking Indent";
+include("prepare.inc");
+$xp = new domxpath($xsl);
+$res = $xp->query("/xsl:stylesheet/xsl:output/@indent");
+if ($res->length != 1) {
+ print "No or more than one xsl:output/@indent found";
+ exit;
+}
+$res->item(0)->value = "yes";
+$proc->importStylesheet($xsl);
+print "\n";
+print $proc->transformToXml($dom);
+print "\n";
+
+
+--EXPECT--
+Test 5: Checking Indent
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html>
+ <body>bar
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body>
+</html>
diff --git a/ext/xsl/tests/xslt006.phpt b/ext/xsl/tests/xslt006.phpt
new file mode 100644
index 0000000..2c0cfed
--- /dev/null
+++ b/ext/xsl/tests/xslt006.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test 6: Transform To Doc
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 6: Transform To Doc";
+include("prepare.inc");
+$proc->importStylesheet($xsl);
+print "\n";
+$doc = $proc->transformToDoc($dom);
+print $doc->saveXML();
+print "\n";
+
+
+--EXPECT--
+Test 6: Transform To Doc
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html><body>bar
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt007.phpt b/ext/xsl/tests/xslt007.phpt
new file mode 100644
index 0000000..486560b
--- /dev/null
+++ b/ext/xsl/tests/xslt007.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test 7: Transform To Uri
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 7: Transform To Uri";
+include("prepare.inc");
+$proc->importStylesheet($xsl);
+print "\n";
+$doc = $proc->transformToUri($dom, "file://".dirname(__FILE__)."/out.xml");
+print file_get_contents(dirname(__FILE__)."/out.xml");
+unlink(dirname(__FILE__)."/out.xml");
+print "\n";
+
+
+--EXPECT--
+Test 7: Transform To Uri
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html><body>bar
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt008.phpt b/ext/xsl/tests/xslt008.phpt
new file mode 100644
index 0000000..438a566
--- /dev/null
+++ b/ext/xsl/tests/xslt008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test 8: Stream Wrapper Includes
+--SKIPIF--
+<?php
+ require_once dirname(__FILE__) .'/skipif.inc';
+ if (!extension_loaded('zlib')) die('skip zlib extension not available');
+?>
+--FILE--
+<?php
+echo "Test 8: Stream Wrapper Includes ";
+include("prepare.inc");
+$xsl = new domDocument;
+$xsl->load(dirname(__FILE__)."/streamsinclude.xsl");
+if(!$xsl) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+chdir(dirname(__FILE__));
+$proc->importStylesheet($xsl);
+print "\n";
+print $proc->transformToXML($dom);
+
+
+--EXPECT--
+Test 8: Stream Wrapper Includes
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html><body>bar
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt009.phpt b/ext/xsl/tests/xslt009.phpt
new file mode 100644
index 0000000..67b0d67
--- /dev/null
+++ b/ext/xsl/tests/xslt009.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test 9: Stream Wrapper XPath-Document()
+--SKIPIF--
+<?php
+ require_once dirname(__FILE__) .'/skipif.inc';
+ if (!extension_loaded('zlib')) die('skip zlib extension not available');
+?>
+--FILE--
+<?php
+echo "Test 9: Stream Wrapper XPath-Document()";
+include("prepare.inc");
+
+$xsl = new domDocument;
+$xsl->load(dirname(__FILE__)."/documentxpath.xsl");
+if(!$xsl) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+
+$proc->importStylesheet($xsl);
+print "\n";
+print $proc->transformToXML($dom);
+
+
+--EXPECT--
+Test 9: Stream Wrapper XPath-Document()
+<?xml version="1.0" encoding="iso-8859-1"?>
+foo
diff --git a/ext/xsl/tests/xslt010.phpt b/ext/xsl/tests/xslt010.phpt
new file mode 100644
index 0000000..96ef8c6
--- /dev/null
+++ b/ext/xsl/tests/xslt010.phpt
@@ -0,0 +1,206 @@
+--TEST--
+Test 10: EXSLT Support
+--SKIPIF--
+<?php
+require_once dirname(__FILE__) .'/skipif.inc';
+$proc = new xsltprocessor;
+if (!$proc->hasExsltSupport()) die('skip EXSLT support not available');
+if (LIBXSLT_VERSION < 10117) die('skip too old libxsl');
+?>
+--FILE--
+<?php
+echo "Test 10: EXSLT Support";
+
+$dom = new domDocument();
+ $dom->load(dirname(__FILE__)."/exslt.xsl");
+ $proc = new xsltprocessor;
+ $xsl = $proc->importStylesheet($dom);
+
+ $xml = new DomDocument();
+ $xml->load(dirname(__FILE__)."/exslt.xml");
+
+ print $proc->transformToXml($xml);
+--EXPECT--
+Test 10: EXSLT Support
+
+
+ Test Date : 0001-12-31Z
+ year : 1
+ leap-year : false
+ month-in-year : 12
+ month-name : December
+ month-abbreviation : Dec
+ week-in-year : 1
+ day-in-year : 365
+ day-in-month : 31
+ day-of-week-in-month : 5
+ day-in-week : 2
+ day-name : Monday
+ day-abbreviation : Mon
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 3000-01-31
+ year : 3000
+ leap-year : false
+ month-in-year : 1
+ month-name : January
+ month-abbreviation : Jan
+ week-in-year : 5
+ day-in-year : 31
+ day-in-month : 31
+ day-of-week-in-month : 5
+ day-in-week : 6
+ day-name : Friday
+ day-abbreviation : Fri
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 2000-02-29
+ year : 2000
+ leap-year : true
+ month-in-year : 2
+ month-name : February
+ month-abbreviation : Feb
+ week-in-year : 9
+ day-in-year : 60
+ day-in-month : 29
+ day-of-week-in-month : 5
+ day-in-week : 3
+ day-name : Tuesday
+ day-abbreviation : Tue
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 9990001-12-31Z
+ year : 9990001
+ leap-year : false
+ month-in-year : 12
+ month-name : December
+ month-abbreviation : Dec
+ week-in-year : 1
+ day-in-year : 365
+ day-in-month : 31
+ day-of-week-in-month : 5
+ day-in-week : 2
+ day-name : Monday
+ day-abbreviation : Mon
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : -0004-02-29
+ year : -4
+ leap-year : true
+ month-in-year : 2
+ month-name : February
+ month-abbreviation : Feb
+ week-in-year : 9
+ day-in-year : 60
+ day-in-month : 29
+ day-of-week-in-month : 5
+ day-in-week : 1
+ day-name : Sunday
+ day-abbreviation : Sun
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 1999-01-02
+ year : 1999
+ leap-year : false
+ month-in-year : 1
+ month-name : January
+ month-abbreviation : Jan
+ week-in-year : 53
+ day-in-year : 2
+ day-in-month : 2
+ day-of-week-in-month : 1
+ day-in-week : 7
+ day-name : Saturday
+ day-abbreviation : Sat
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 1999-01-03
+ year : 1999
+ leap-year : false
+ month-in-year : 1
+ month-name : January
+ month-abbreviation : Jan
+ week-in-year : 53
+ day-in-year : 3
+ day-in-month : 3
+ day-of-week-in-month : 1
+ day-in-week : 1
+ day-name : Sunday
+ day-abbreviation : Sun
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 2004-01-01
+ year : 2004
+ leap-year : true
+ month-in-year : 1
+ month-name : January
+ month-abbreviation : Jan
+ week-in-year : 1
+ day-in-year : 1
+ day-in-month : 1
+ day-of-week-in-month : 1
+ day-in-week : 5
+ day-name : Thursday
+ day-abbreviation : Thu
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 2006-01-01
+ year : 2006
+ leap-year : false
+ month-in-year : 1
+ month-name : January
+ month-abbreviation : Jan
+ week-in-year : 52
+ day-in-year : 1
+ day-in-month : 1
+ day-of-week-in-month : 1
+ day-in-week : 1
+ day-name : Sunday
+ day-abbreviation : Sun
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
+ Test Date : 2007-12-31
+ year : 2007
+ leap-year : false
+ month-in-year : 12
+ month-name : December
+ month-abbreviation : Dec
+ week-in-year : 1
+ day-in-year : 365
+ day-in-month : 31
+ day-of-week-in-month : 5
+ day-in-week : 2
+ day-name : Monday
+ day-abbreviation : Mon
+ time :
+ hour-in-day : NaN
+ minute-in-hour : NaN
+ second-in-minute : NaN
+
diff --git a/ext/xsl/tests/xslt011.phpt b/ext/xsl/tests/xslt011.phpt
new file mode 100644
index 0000000..efa2dd7
--- /dev/null
+++ b/ext/xsl/tests/xslt011.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test 11: php:function Support
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+print "Test 11: php:function Support\n";
+ Class foo {
+ function foo() {}
+ function __toString() { return "not a DomNode object";}
+ }
+
+$dom = new domDocument();
+ $dom->load(dirname(__FILE__)."/xslt011.xsl");
+ $proc = new xsltprocessor;
+ $xsl = $proc->importStylesheet($dom);
+
+ $xml = new DomDocument();
+ $xml->load(dirname(__FILE__)."/xslt011.xml");
+ $proc->registerPHPFunctions();
+ print $proc->transformToXml($xml);
+
+ function foobar($id, $secondArg = "" ) {
+ if (is_array($id)) {
+ return $id[0]->value . " - " . $secondArg;
+ } else {
+ return $id . " - " . $secondArg;
+ }
+ }
+ function nodeSet($id = null) {
+ if ($id and is_array($id)) {
+ return $id[0];
+ } else {
+ $dom = new domdocument;
+ $dom->loadXML("<root>this is from an external DomDocument</root>");
+ return $dom->documentElement;
+ }
+ }
+ function nonDomNode() {
+ return new foo();
+ }
+
+ class aClass {
+ static function aStaticFunction($id) {
+ return $id;
+ }
+ }
+
+--EXPECTF--
+Test 11: php:function Support
+
+Warning: XSLTProcessor::transformToXml(): A PHP Object cannot be converted to a XPath-string in %s on line 16
+<?xml version="1.0"?>
+foobar - secondArg
+foobar -
+this is from an external DomDocument
+from the Input Document
+static
+
diff --git a/ext/xsl/tests/xslt011.xml b/ext/xsl/tests/xslt011.xml
new file mode 100644
index 0000000..f40500b
--- /dev/null
+++ b/ext/xsl/tests/xslt011.xml
@@ -0,0 +1 @@
+<doc id="foobar">This is <i>from the Input Document</i></doc>
diff --git a/ext/xsl/tests/xslt011.xsl b/ext/xsl/tests/xslt011.xsl
new file mode 100644
index 0000000..e1960e5
--- /dev/null
+++ b/ext/xsl/tests/xslt011.xsl
@@ -0,0 +1,25 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl"
+ xsl:extension-element-prefixes="php"
+ version='1.0'>
+<xsl:template match="/">
+<xsl:value-of select="php:functionString('foobar', /doc/@id, 'secondArg')"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('foobar', /doc/@id)"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('nodeSet')"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('nodeSet',/doc)/i"/>
+<xsl:text>
+</xsl:text>
+<xsl:value-of select="php:function('aClass::aStaticFunction','static')"/>
+<xsl:text>
+</xsl:text>
+
+<xsl:value-of select="php:function('nonDomNode')"/>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/xslt012.phpt b/ext/xsl/tests/xslt012.phpt
new file mode 100644
index 0000000..9fd3fbd
--- /dev/null
+++ b/ext/xsl/tests/xslt012.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test 12: Using Associative Array of Parameters
+--SKIPIF--
+<?php require_once dirname(__FILE__) .'/skipif.inc'; ?>
+--FILE--
+<?php
+echo "Test 12: Using Associative Array of Parameters";
+
+$dom = new domDocument;
+$dom->load(dirname(__FILE__)."/xslt.xml");
+if(!$dom) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+
+$xsl = new domDocument;
+$xsl->load(dirname(__FILE__)."/xslt012.xsl");
+if(!$xsl) {
+ echo "Error while parsing the document\n";
+ exit;
+}
+
+$proc = new xsltprocessor;
+if(!$proc) {
+ echo "Error while making xsltprocessor object\n";
+ exit;
+}
+
+
+$proc->importStylesheet($xsl);
+
+$parameters = Array(
+ 'foo' => 'barbar',
+ 'foo1' => 'test',
+ );
+
+$proc->setParameter( "", $parameters);
+
+print "\n";
+print $proc->transformToXml($dom);
+print "\n";
+
+
+--EXPECT--
+Test 12: Using Associative Array of Parameters
+<?xml version="1.0" encoding="iso-8859-1"?>
+<html><body>barbar
+test
+a1 b1 c1 <br/>
+a2 c2 <br/>
+3 b3 c3 <br/>
+</body></html>
diff --git a/ext/xsl/tests/xslt012.xsl b/ext/xsl/tests/xslt012.xsl
new file mode 100644
index 0000000..27f4138
--- /dev/null
+++ b/ext/xsl/tests/xslt012.xsl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Id: xslt012.xsl,v 1.1 2004-08-05 13:31:17 tony2001 Exp $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+
+ <xsl:output method="xml" encoding="iso-8859-1" indent="no"/>
+ <xsl:param name="foo" select="'bar'"/>
+ <xsl:param name="foo1" select="'bar1'"/>
+ <xsl:template match="/">
+ <html>
+ <body>
+ <xsl:value-of select="$foo"/><xsl:text>
+</xsl:text>
+ <xsl:value-of select="$foo1"/><xsl:text>
+</xsl:text>
+ <xsl:apply-templates select="/chapter/para/informaltable/tgroup/tbody/row"/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="row">
+ <xsl:for-each select="entry">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ <br/> <xsl:text>
+</xsl:text>
+
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt b/ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt
new file mode 100644
index 0000000..19f7791
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_getParameter-invalidparam.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Check xsltprocessor::getParameter with undefined parameter
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+var_dump($proc->getParameter('', 'doesnotexist'));
+--EXPECTF--
+bool(false)
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt b/ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt
new file mode 100644
index 0000000..758d4ba
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_getParameter-wrongparam.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Check xsltprocessor::getparameter error handling
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+var_dump($proc->getParameter());
+var_dump($proc->getParameter(array(), array()));
+var_dump($proc->getParameter('', array()));
+--EXPECTF--
+Warning: XSLTProcessor::getParameter() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: XSLTProcessor::getParameter() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+bool(false)
+
+Warning: XSLTProcessor::getParameter() expects parameter 2 to be %binary_string_optional%, array given in %s on line %d
+bool(false)
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_getParameter.phpt b/ext/xsl/tests/xsltprocessor_getParameter.phpt
new file mode 100644
index 0000000..2430bc8
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_getParameter.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Check xsltprocessor::getparameter functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$proc->importStylesheet($xsl);
+$proc->setParameter('', 'key', 'value');
+var_dump($proc->getParameter('', 'key'));
+--EXPECTF--
+%string|unicode%(5) "value"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt
new file mode 100644
index 0000000..1f0453e
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-allfuncs.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions());
+var_dump($proc->transformToXml($dom));
+
+//var_dump($proc->registerPHPFunctions(array()));
+//var_dump($proc->transformToXml($dom));
+
+--EXPECTF--
+NULL
+string(18) "This Is An Example"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt
new file mode 100644
index 0000000..a5f2373
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-multiple.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions with array called multiple times
+--DESCRIPTION--
+When being called multiple times with an array,
+registerPHPFunctions adds the new functions to the allowed parameter
+list - it does not replace the previously allowed functions.
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions(array('strpos', 'ucwords')));
+var_dump($proc->registerPHPFunctions(array('strrev', 'array_key_exists')));
+var_dump($proc->registerPHPFunctions(array()));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+NULL
+NULL
+string(18) "This Is An Example"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt
new file mode 100644
index 0000000..9492fc6
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array-notallowed.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions with array and a not allowed function
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions(array()));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+
+Warning: XSLTProcessor::transformToXml(): Not allowed to call handler 'ucwords()' in %s on line %d
+NULL
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt
new file mode 100644
index 0000000..0e467aa
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-array.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions with array
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions(array('ucwords')));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+string(18) "This Is An Example"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
new file mode 100644
index 0000000..90d9c68
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions and a non-string function in xsl
+--DESCRIPTION--
+The XSL script tries to call a php function that is not a string which
+is expected to fail
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc-nostring.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions());
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+
+Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %s on line %d
+NULL
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
new file mode 100644
index 0000000..a26c210
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions and a undefined php function
+--DESCRIPTION--
+The XSL script tries to call a php function that is not defined
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc-undef.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions());
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+
+Warning: XSLTProcessor::transformToXml(): Unable to call handler undefinedfunc() in %s on line %d
+NULL
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt
new file mode 100644
index 0000000..f74d785
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-null.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions called with null to reset
+--DESCRIPTION--
+When being called multiple times with an array,
+registerPHPFunctions adds the new functions to the allowed parameter
+list - it does not replace the previously allowed functions.
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions('ucwords'));
+var_dump($proc->registerPHPFunctions(null));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+NULL
+string(18) "This Is An Example"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt
new file mode 100644
index 0000000..f15c08d
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-multiple.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions with string called multiple times
+--DESCRIPTION--
+When being called multiple times with a stringular function name only,
+registerPHPFunctions adds the new function to the allowed parameter
+list - it does not replace the old function.
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions('ucwords'));
+var_dump($proc->registerPHPFunctions('strpos'));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+NULL
+string(18) "This Is An Example"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt
new file mode 100644
index 0000000..9257749
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string-notallowed.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions with string and not allowed function
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions('strpos'));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+
+Warning: XSLTProcessor::transformToXml(): Not allowed to call handler 'ucwords()' in %s on line %d
+NULL
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt
new file mode 100644
index 0000000..5fbba90
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_registerPHPFunctions-string.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Check xsltprocessor::registerPHPFunctions with string
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$phpfuncxsl = new domDocument();
+$phpfuncxsl->load(dirname(__FILE__)."/phpfunc.xsl");
+if(!$phpfuncxsl) {
+ echo "Error while parsing the xsl document\n";
+ exit;
+}
+$proc->importStylesheet($phpfuncxsl);
+var_dump($proc->registerPHPFunctions('ucwords'));
+var_dump($proc->transformToXml($dom));
+--EXPECTF--
+NULL
+string(18) "This Is An Example"
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt b/ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt
new file mode 100644
index 0000000..f35b470
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_removeParameter-invalidparam.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Check xsltprocessor::removeParameter with invalid parameter
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$proc->importStylesheet($xsl);
+var_dump($proc->removeParameter('', 'doesnotexist'));
+--EXPECT--
+bool(false)
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt b/ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt
new file mode 100644
index 0000000..c2b4f4c
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_removeParameter-wrongparams.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Check xsltprocessor::removeParameter wrong parameter handling
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$proc->removeParameter();
+$proc->removeParameter(array(), array());
+$proc->removeParameter('', array());
+--EXPECTF--
+Warning: XSLTProcessor::removeParameter() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: XSLTProcessor::removeParameter() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+
+Warning: XSLTProcessor::removeParameter() expects parameter 2 to be %binary_string_optional%, array given in %s on line %d
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_removeParameter.phpt b/ext/xsl/tests/xsltprocessor_removeParameter.phpt
new file mode 100644
index 0000000..92be056
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_removeParameter.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Check xsltprocessor::removeParameter functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$proc->importStylesheet($xsl);
+$proc->setParameter('', 'key', 'value');
+$proc->removeParameter('', 'key');
+var_dump($proc->getParameter('', 'key'));
+--EXPECT--
+bool(false)
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt b/ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt
new file mode 100644
index 0000000..44e49de
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_setparameter-errorquote.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Check xsltprocessor::setparameter error handling with both single and double quotes
+--DESCRIPTION--
+Memleak: http://bugs.php.net/bug.php?id=48221
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$proc->importStylesheet($xsl);
+$proc->setParameter('', '', '"\'');
+$proc->transformToXml($dom);
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml(): Cannot create XPath expression (string contains both quote and double-quotes) in %s on line %d
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09
diff --git a/ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt b/ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt
new file mode 100644
index 0000000..c4fcd70
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_setparameter-nostring.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Check xsltprocessor::setparameter error handling with no-string
+--DESCRIPTION--
+Memleak: http://bugs.php.net/bug.php?id=48221
+--SKIPIF--
+<?php
+ if (!extension_loaded('xsl')) {
+ die("skip\n");
+ }
+?>
+--FILE--
+<?php
+include dirname(__FILE__) .'/prepare.inc';
+$proc->importStylesheet($xsl);
+var_dump($proc->setParameter('', array(4, 'abc')));
+$proc->transformToXml($dom);
+--EXPECTF--
+Warning: XSLTProcessor::setParameter(): Invalid parameter array in %s on line %d
+bool(false)
+--CREDITS--
+Christian Weiske, cweiske@php.net
+PHP Testfest Berlin 2009-05-09