summaryrefslogtreecommitdiff
path: root/ext/xsl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/xsl')
-rw-r--r--ext/xsl/php_xsl.c2
-rw-r--r--ext/xsl/php_xsl.h2
-rw-r--r--ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt13
-rw-r--r--ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt13
-rw-r--r--ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt13
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToDoc.phpt51
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt54
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt56
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt54
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt56
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt56
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToURI.phpt53
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt54
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt57
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt57
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt57
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt56
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToXML.phpt61
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt54
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt55
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt54
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt55
-rw-r--r--ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt55
-rw-r--r--ext/xsl/xsl_fe.h2
-rw-r--r--ext/xsl/xsltprocessor.c2
25 files changed, 1038 insertions, 4 deletions
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 3d63dd064..8c434c94e 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2014 The PHP Group |
+ | Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h
index a45785681..856e3679c 100644
--- a/ext/xsl/php_xsl.h
+++ b/ext/xsl/php_xsl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2014 The PHP Group |
+ | Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt
new file mode 100644
index 000000000..226712930
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test the basics to function XSLTProcessor::hasExsltSupport().
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$proc = new XSLTProcessor();
+var_dump($proc->hasExsltSupport());
+?>
+--EXPECTF--
+bool(true) \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt
new file mode 100644
index 000000000..d8b8fa846
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test the basics to function XSLTProcessor::hasExsltSupport() when the xsl extension os not available.
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php (!extension_loaded('xsl')) or die('skip xsl extension is available'); ?>
+--FILE--
+<?php
+$proc = new XSLTProcessor();
+var_dump($proc->hasExsltSupport());
+?>
+--EXPECTF--
+Fatal error: Class 'XSLTProcessor' not found in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt
new file mode 100644
index 000000000..107157fa2
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Check XSLTProcessor::hasExsltSupport() with 1 parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$proc = new XSLTProcessor();
+var_dump($proc->hasExsltSupport('stringValue'));
+?>
+--EXPECTF--
+bool(true) \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc.phpt
new file mode 100644
index 000000000..ff4be47e3
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToDoc.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test the basics to function XSLTProcessor::transformToDoc().
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>royopa</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+var_dump($proc->transformToDoc($xmldoc)->firstChild->tagName);
+?>
+--EXPECT--
+string(4) "html" \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt
new file mode 100644
index 000000000..735fd7295
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Check XSLTProcessor::transformToDoc() with null parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+echo $proc->transformToDoc(null);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, null given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt
new file mode 100644
index 000000000..1460de39a
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Check XSLTProcessor::transformToDoc() with array parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = array();
+
+echo $proc->transformToDoc($wrong_parameter);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, array given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt
new file mode 100644
index 000000000..2c6c99ae2
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Check XSLTProcessor::transformToDoc() with 4 parameters
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+echo $proc->transformToDoc($xmldoc, 'string', 98, true);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToDoc() expects at most 2 parameters, 4 given in %s on line %i
diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt
new file mode 100644
index 000000000..19fc3e44e
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Check XSLTProcessor::transformToDoc() with string parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = 'stringValue';
+
+echo $proc->transformToDoc($wrong_parameter);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, string given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt
new file mode 100644
index 000000000..8df84b7cb
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Check XSLTProcessor::transformToDoc() with boolean parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = true;
+
+echo $proc->transformToDoc($wrong_parameter);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, boolean given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToURI.phpt b/ext/xsl/tests/xsltprocessor_transformToURI.phpt
new file mode 100644
index 000000000..27ed4e297
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToURI.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test the basics to function XSLTProcessor::transformToURI().
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+var_dump($proc->transformToURI($xsldoc, 'php://output'));
+?>
+--EXPECTF--
+int(56) \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt
new file mode 100644
index 000000000..69afeaf7b
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Check XSLTProcessor::transformToURI() with null parameters
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+echo $proc->transformToURI(null, null);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, null given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt
new file mode 100644
index 000000000..64b98ce7e
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Check XSLTProcessor::transformToURI() with array parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = array();
+$uri = 'php://output';
+
+echo $proc->transformToURI($wrong_parameter, $uri);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, array given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt
new file mode 100644
index 000000000..7f497ba2b
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Check XSLTProcessor::transformToURI() with string parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = 'stringValue';
+$uri = 'php://output';
+
+echo $proc->transformToURI($wrong_parameter, $uri);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, string given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt
new file mode 100644
index 000000000..c7742422f
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Check XSLTProcessor::transformToURI() with boolean parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = false;
+$uri = 'php://output';
+
+echo $proc->transformToURI($wrong_parameter, $uri);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, boolean given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt
new file mode 100644
index 000000000..c1de1d93c
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Check XSLTProcessor::transformToURI() with 3 parameters
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$uri = 'php://output';
+
+echo $proc->transformToURI($xsldoc, $uri, 'stringValue');
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToUri() expects exactly 2 parameters, 3 given in %s on line %i \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToXML.phpt b/ext/xsl/tests/xsltprocessor_transformToXML.phpt
new file mode 100644
index 000000000..c70200d10
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToXML.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test the basics to function XSLTProcessor::transformToXml().
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+var_dump($proc->transformToXML($xmldoc));
+?>
+--EXPECT--
+string(135) "<html xmlns:php="http://php.net/xsl"><body>
+<h2>Users</h2>
+<table>
+<tr><td>Bob</td></tr>
+<tr><td>Joe</td></tr>
+</table>
+</body></html>
+" \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt
new file mode 100644
index 000000000..a7689df07
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Check XSLTProcessor::transformToXml() with null parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+echo $proc->transformToXML(null);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, null given in %s on line %i
diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt
new file mode 100644
index 000000000..32e1a8095
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Check XSLTProcessor::transformToXML() with array parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = array();
+echo $proc->transformToXML($wrong_parameter);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, array given in %s on line %d \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt
new file mode 100644
index 000000000..69b9305e1
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Check XSLTProcessor::transformToXML() with 3 parameters
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+echo $proc->transformToXML($xmldoc, 'string', 98);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml() expects exactly 1 parameter, 3 given in %s on line %i
diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt
new file mode 100644
index 000000000..05cb7ebd9
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Check XSLTProcessor::transformToXML() with string parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = 'stringValue';
+echo $proc->transformToXML($wrong_parameter);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, string given in %s on line %d \ No newline at end of file
diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt
new file mode 100644
index 000000000..87db6e14d
--- /dev/null
+++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Check XSLTProcessor::transformToXML() with boolean parameter
+--CREDITS--
+Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
+--SKIPIF--
+<?php extension_loaded('xsl') or die('skip xsl extension is not available'); ?>
+--FILE--
+<?php
+$xml = <<<EOB
+<allusers>
+ <user>
+ <uid>bob</uid>
+ </user>
+ <user>
+ <uid>joe</uid>
+ </user>
+</allusers>
+EOB;
+$xsl = <<<EOB
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:php="http://php.net/xsl">
+<xsl:output method="html" encoding="utf-8" indent="yes"/>
+ <xsl:template match="allusers">
+ <html><body>
+ <h2>Users</h2>
+ <table>
+ <xsl:for-each select="user">
+ <tr><td>
+ <xsl:value-of
+ select="php:function('ucfirst',string(uid))"/>
+ </td></tr>
+ </xsl:for-each>
+ </table>
+ </body></html>
+ </xsl:template>
+</xsl:stylesheet>
+EOB;
+
+$xmldoc = new DOMDocument('1.0', 'utf-8');
+$xmldoc->loadXML($xml);
+
+$xsldoc = new DOMDocument('1.0', 'utf-8');
+$xsldoc->loadXML($xsl);
+
+$proc = new XSLTProcessor();
+$proc->registerPHPFunctions();
+$proc->importStyleSheet($xsldoc);
+
+$wrong_parameter = true;
+echo $proc->transformToXML($wrong_parameter);
+?>
+--EXPECTF--
+Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, boolean given in %s on line %d \ No newline at end of file
diff --git a/ext/xsl/xsl_fe.h b/ext/xsl/xsl_fe.h
index 89726da72..7b316a452 100644
--- a/ext/xsl/xsl_fe.h
+++ b/ext/xsl/xsl_fe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2014 The PHP Group |
+ | Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 67c90f501..115ee5ce6 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2014 The PHP Group |
+ | Copyright (c) 1997-2015 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |