diff options
Diffstat (limited to 'ext/xslt/tests')
-rwxr-xr-x | ext/xslt/tests/args.xsl | 10 | ||||
-rw-r--r-- | ext/xslt/tests/bug17791.phpt | 15 | ||||
-rw-r--r-- | ext/xslt/tests/bug17931.phpt | 32 | ||||
-rw-r--r-- | ext/xslt/tests/bug20177.phpt | 34 | ||||
-rw-r--r-- | ext/xslt/tests/bug20518.phpt | 33 | ||||
-rw-r--r-- | ext/xslt/tests/param.xsl | 15 | ||||
-rwxr-xr-x | ext/xslt/tests/public.xml | 5 | ||||
-rwxr-xr-x | ext/xslt/tests/qa.dtd | 7 | ||||
-rw-r--r-- | ext/xslt/tests/skipif.inc | 5 | ||||
-rw-r--r-- | ext/xslt/tests/test.xml | 5 | ||||
-rw-r--r-- | ext/xslt/tests/xslt-001.phpt | 21 | ||||
-rw-r--r-- | ext/xslt/tests/xslt.phpt | 12 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_backend_info.phpt | 49 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_getopt.phpt | 37 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_process-001.phpt | 62 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_process-002.phpt | 74 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_set_object.phpt | 89 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_set_object.xsl | 3 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_set_scheme_handlers-001.phpt | 20 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_set_scheme_handlers-002.phpt | 57 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_set_scheme_handlers-003.phpt | 47 | ||||
-rw-r--r-- | ext/xslt/tests/xslt_setopt.phpt | 60 |
22 files changed, 0 insertions, 692 deletions
diff --git a/ext/xslt/tests/args.xsl b/ext/xslt/tests/args.xsl deleted file mode 100755 index 4ff140c777..0000000000 --- a/ext/xslt/tests/args.xsl +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:output encoding="ISO-8859-1" method="text" omit-xml-declaration="yes" /> - <xsl:template match="/qa"> - <xsl:apply-templates select="test" /> - </xsl:template> - <xsl:template match="test[@type = 'simple']"> - <xsl:value-of select="." /> - </xsl:template> -</xsl:stylesheet> diff --git a/ext/xslt/tests/bug17791.phpt b/ext/xslt/tests/bug17791.phpt deleted file mode 100644 index 0a9446e1b0..0000000000 --- a/ext/xslt/tests/bug17791.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Pass long string to 'file' argument, bug #17791 ---SKIPIF-- -<?php include("skipif.inc"); ?> ---FILE-- -<?php -$xmlstring = str_repeat('x', 512); -$xslstring = 'x'; -$xh = xslt_create(); -$result = @xslt_process($xh, $xmlstring, $xslstring); -@xslt_free($xh); -echo("OK"); -?> ---EXPECT-- -OK diff --git a/ext/xslt/tests/bug17931.phpt b/ext/xslt/tests/bug17931.phpt deleted file mode 100644 index a85dd0674e..0000000000 --- a/ext/xslt/tests/bug17931.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Pass object for xslt_error_handler, bug #17931 ---SKIPIF-- -<?php include("skipif.inc"); ?> ---FILE-- -<?php -class xsl { - - function xsl() { - $this->_parser = xslt_create(); - } - - function set_error() { - xslt_set_error_handler($this->_parser, array($this, 'xslt_trap_error')); - echo "OK"; - } - - function xslt_trap_error($parser, $errorno, $level, $fields) { - return TRUE; - } - function clean() { - xslt_free($this->_parser); - } -} - -$x = new xsl; -// work-around for possible '$this does not exist' bug in constructor -$x->set_error(); -$x->clean(); -?> ---EXPECT-- -OK diff --git a/ext/xslt/tests/bug20177.phpt b/ext/xslt/tests/bug20177.phpt deleted file mode 100644 index 3c1695b351..0000000000 --- a/ext/xslt/tests/bug20177.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Relative and absolute arg handling ---SKIPIF-- -<?php -include("skipif.inc"); -if(!function_exists('utf8_encode')) { - die("skip function utf8_encode() not available"); -} -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -error_reporting(E_ALL); -$xslfile = dirname(__FILE__) . '/args.xsl'; -$xslsheet = @implode('', @file($xslfile)); -$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>'; -$xmldata .= '<!DOCTYPE qa SYSTEM "qa.dtd">' . "\n"; -$xmldata .=' -<qa> - <test type="simple">Test has passed</test> - <test type="complex" /> -</qa>'; - -$xh = xslt_create(); -$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata)); -print "$result\n"; -$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet)); -print "$result\n"; -xslt_free($xh); -?> ---EXPECT-- -Test has passed -Test has passed diff --git a/ext/xslt/tests/bug20518.phpt b/ext/xslt/tests/bug20518.phpt deleted file mode 100644 index bf0a8f9f8d..0000000000 --- a/ext/xslt/tests/bug20518.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Don't override xslt_set_base (bug #20518) ---SKIPIF-- -<?php // vim600: syn=php ts=4 sw=4 -include("skipif.inc"); -mkdir(dirname(__FILE__) . '/tmp', 0777) or die("skip Cannot create working directory"); -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -error_reporting(E_ALL); -copy(dirname(__FILE__) . '/qa.dtd', dirname(__FILE__) . '/tmp/qa.dtd'); -$xslfile = dirname(__FILE__) . '/args.xsl'; -$xslsheet = @implode('', @file($xslfile)); -$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?>'; -$xmldata .= '<!DOCTYPE qa SYSTEM "qa.dtd">' . "\n"; -$xmldata .=' -<qa> - <test type="simple">Test has passed</test> - <test type="complex" /> -</qa>'; - -$xh = xslt_create(); -xslt_set_base($xh, 'file://' . dirname(__FILE__) . '/tmp/'); -$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet)); -print "$result\n"; -xslt_free($xh); -unlink(dirname(__FILE__) . '/tmp/qa.dtd'); -rmdir(dirname(__FILE__) . '/tmp'); -?> ---EXPECT-- -Test has passed diff --git a/ext/xslt/tests/param.xsl b/ext/xslt/tests/param.xsl deleted file mode 100644 index 64b78fafe7..0000000000 --- a/ext/xslt/tests/param.xsl +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" /> - <xsl:param name="insertion">Test failed</xsl:param> - <xsl:template match="/qa"> - <xsl:apply-templates select="test" /> - </xsl:template> - <xsl:template match="test"> - <xsl:choose> - <xsl:when test="@type != 'simple'"> - <xsl:value-of select="$insertion" /> - </xsl:when> - </xsl:choose> - </xsl:template> -</xsl:stylesheet> diff --git a/ext/xslt/tests/public.xml b/ext/xslt/tests/public.xml deleted file mode 100755 index d5de9a8bd5..0000000000 --- a/ext/xslt/tests/public.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE qa PUBLIC "-//PHP-QA//PHP Quality Assurance DTD //EN" "qa.dtd">
-<qa>
- <test type="simple">PHP QA®</test>
-</qa>
diff --git a/ext/xslt/tests/qa.dtd b/ext/xslt/tests/qa.dtd deleted file mode 100755 index 8b807ead44..0000000000 --- a/ext/xslt/tests/qa.dtd +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!ELEMENT qa (test+)> -<!ELEMENT test (#PCDATA)> -<!ATTLIST test - type CDATA #IMPLIED -> -<!ENTITY reg "®"> diff --git a/ext/xslt/tests/skipif.inc b/ext/xslt/tests/skipif.inc deleted file mode 100644 index 7cffae6c66..0000000000 --- a/ext/xslt/tests/skipif.inc +++ /dev/null @@ -1,5 +0,0 @@ -<?php -if(!extension_loaded("xslt")) { - die("skip xslt extension not available"); -} -?> diff --git a/ext/xslt/tests/test.xml b/ext/xslt/tests/test.xml deleted file mode 100644 index f7c69d4c4a..0000000000 --- a/ext/xslt/tests/test.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<qa> - <test type="simple">Test has passed</test> - <test type="complex" /> -</qa> diff --git a/ext/xslt/tests/xslt-001.phpt b/ext/xslt/tests/xslt-001.phpt deleted file mode 100644 index eeb1c6d769..0000000000 --- a/ext/xslt/tests/xslt-001.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Memoryleak in error printing ---SKIPIF-- -<?php include("skipif.inc"); ?> ---INI-- -error_reporting=2047 -display_errors=0 -track_errors=1 ---FILE-- -<?php -$xmlfile = 'ext/xslt/tests/non-existent.xml'; -$xslfile = 'ext/xslt/tests/non-existent.xsl'; - -$xh = xslt_create(); -$result = xslt_process($xh, $xmlfile, $xslfile, NULL); -xslt_free($xh); - -echo $php_errormsg."\n"; -?> ---EXPECTF-- -Sablotron error on line none: cannot open file '%s/ext/xslt/tests/non-existent.xsl' diff --git a/ext/xslt/tests/xslt.phpt b/ext/xslt/tests/xslt.phpt deleted file mode 100644 index 3270c3f20e..0000000000 --- a/ext/xslt/tests/xslt.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Check for xslt presence ---SKIPIF-- -<?php if (!extension_loaded("xslt")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<?php -echo "xslt extension is available"; -?> ---EXPECT-- -xslt extension is available
\ No newline at end of file diff --git a/ext/xslt/tests/xslt_backend_info.phpt b/ext/xslt/tests/xslt_backend_info.phpt deleted file mode 100644 index 1fd849c48f..0000000000 --- a/ext/xslt/tests/xslt_backend_info.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -xslt_backend_info: examples for detection of backend features ---SKIPIF-- -<?php // vim600: noet sw=4 ts=4 syn=php ai si tw=78 -include("skipif.inc"); -if(!function_exists('xslt_backend_info')) { - die("skip\n"); -} -// Yeah-right-but-still -if(xslt_backend_name() != "Sablotron") { - die("skip This test currently only supports Sablotron"); -} -if("No information available." == xslt_backend_info()) { - die("skip Information could not be detected."); -} -?> ---FILE-- -<?php -/* - * Test xslt_backend_info: basically this test is provided as a how-to for - * x-platform packages, which rely on certain features which may or may - * not be available depending on what has been linked into the backend. - */ - -$tmp = explode("\n", xslt_backend_info()); -$info = array(); -foreach($tmp AS $line) { - list($key, $value) = explode(": ", $line, 2); - $info[strtolower($key)] = $value; -} - -if(FALSE === strstr($info['libs'], " -lexpat")) { - die("You're configuration is missing expat, which conflicts with sanity."); -} - -if(FALSE === strstr($info['libs'], " -liconv")) { - echo("You don't have iconv support\n"); -} else { - echo("You have iconv support\n"); -} -if(FALSE === strstr($info['libs'], " -ljs")) { - echo("You don't have JavaScript support\n"); -} else { - echo("You have JavaScript support\n"); -} -?> ---EXPECTREGEX-- -You (don't )?have iconv support -You (don't )?have JavaScript support diff --git a/ext/xslt/tests/xslt_getopt.phpt b/ext/xslt/tests/xslt_getopt.phpt deleted file mode 100644 index a00a875fac..0000000000 --- a/ext/xslt/tests/xslt_getopt.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -xslt_getopt function ---SKIPIF-- -<?php -include("skipif.inc"); -if(!function_exists('xslt_getopt')) { - die("skip\n"); -} -?> ---FILE-- -<?php -error_reporting(E_ALL); - -$xh = xslt_create(); -xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES); -if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES) - print("OK\n"); -else - var_dump(xslt_getopt($xh)); - -xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META); -if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META) - print("OK\n"); -else - var_dump(xslt_getopt($xh)); - -xslt_setopt($xh, xslt_getopt($xh) | XSLT_OPT_SILENT); -if(xslt_getopt($xh) == XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META | XSLT_OPT_SILENT) - print("OK\n"); -else - var_dump(xslt_getopt($xh)); -xslt_free($xh); -?> ---EXPECT-- -OK -OK -OK diff --git a/ext/xslt/tests/xslt_process-001.phpt b/ext/xslt/tests/xslt_process-001.phpt deleted file mode 100644 index 15f9cae262..0000000000 --- a/ext/xslt/tests/xslt_process-001.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -Various ways to provide xml and xslt arguments and params ---SKIPIF-- -<?php -include("skipif.inc"); -if(!function_exists('utf8_encode')) { - die("skip function utf8_encode() not available"); -} -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -error_reporting(E_ALL); -$xmlfile = 'ext/xslt/tests/test.xml'; -$xslfile = 'ext/xslt/tests/args.xsl'; -$xmldata = @implode('', @file($xmlfile)); -$xslsheet = @implode('', @file($xslfile)); - -$xh = xslt_create(); -$result = xslt_process($xh, $xmlfile, $xslfile); -print "$result\n"; -$result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata)); -print "$result\n"; -$result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet)); -print "$result\n"; -$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet)); -print "$result\n"; - -// The same, with params -$xslfile = 'ext/xslt/tests/param.xsl'; -$xslsheet = implode('', file($xslfile)); -$params = array("Test has passed", "PHP QA®"); - -foreach($params AS $val) -{ - $val = utf8_encode($val); - $result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val)); - print "$result\n"; - $result = xslt_process($xh, 'arg:/_xml', $xslfile, NULL, array('/_xml' => $xmldata), array('insertion' => $val)); - print "$result\n"; - $result = xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslsheet), array('insertion' => $val)); - print "$result\n"; - $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmldata, '/_xsl' => $xslsheet), array('insertion' => $val)); - print "$result\n"; -} - -xslt_free($xh); -?> ---EXPECT-- -Test has passed -Test has passed -Test has passed -Test has passed -Test has passed -Test has passed -Test has passed -Test has passed -PHP QA® -PHP QA® -PHP QA® -PHP QA® diff --git a/ext/xslt/tests/xslt_process-002.phpt b/ext/xslt/tests/xslt_process-002.phpt deleted file mode 100644 index 7c6f14fa45..0000000000 --- a/ext/xslt/tests/xslt_process-002.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -Crash xslt_process with reused handler (this test may take a while) ---SKIPIF-- -<?php -include("skipif.inc"); -if(!function_exists('utf8_encode')) { - die("skip\n"); -} -?> ---FILE-- -<?php -error_reporting(E_ALL); -$xmlfile = 'ext/xslt/tests/test.xml'; -$xslfile = 'ext/xslt/tests/param.xsl'; -$xmldata = @implode('', @file($xmlfile)); -$xslsheet = @implode('', @file($xslfile)); - -/* - * Tested on a Cyrix 200MMX/128MB took 2 secs. Should be a reasonable margin. - * - * It's not meant as an actual speed test, but if it's slower than this, - * there must be something significantly off in the php/sablot/expat trio. - * Emulation OS's come to mind... - */ -$want_time = 6; - -function make_param() -{ - $ret_val = ''; - $numchars = mt_rand(2,16); - $illegal = array(0,256,512); - for($i=0;$i<$numchars;$i++) - { - $char=0; - while(in_array($char, $illegal)) - { - $char .= mt_rand(32, 512); - } - $ret_val .= chr($char); - } - - return utf8_encode($ret_val); -} - -function decode($string) -{ - $ret_val = ''; - for($i=0; $i<strlen($string);$i++) - { - $ret_val .= ord(substr($string,$i,1)) . " "; - } - return $ret_val; -} - - -$xh = xslt_create(); - -$t1 = time(); -for ($i=0; $i<50; $i++) -{ - $val = make_param(); - $result = xslt_process($xh, $xmlfile, $xslfile, NULL, NULL, array('insertion' => $val)); - if(!$result or $result != utf8_decode($val)) - print "Failed $i / ".utf8_decode($val).": $result\n\tDecode: " . decode(utf8_decode($val)) . "\n" ; -} -print "OK\n"; -xslt_free($xh); -$t2 = time(); -$op_time = $t2 - $t1; -if($op_time > $want_time) - print "This test took more than $want_time seconds. Either you have a very slow / busy machine, or there's something very wrong with the speed. Your time: $op_time"; -?> ---EXPECT-- -OK diff --git a/ext/xslt/tests/xslt_set_object.phpt b/ext/xslt/tests/xslt_set_object.phpt deleted file mode 100644 index fdc0291a4d..0000000000 --- a/ext/xslt/tests/xslt_set_object.phpt +++ /dev/null @@ -1,89 +0,0 @@ ---TEST-- -xslt_set_object function ---SKIPIF-- -<?php -include("skipif.inc"); -if(!function_exists('xslt_set_object')) { - die("skip function xslt_set_object() not available"); -} -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -error_reporting(E_ALL); -class XSLTTester -{ - var $_success = false; - var $_success2 = false; - - function XSLTTester() - {} - - // this function will register this object as the - // callback object. - function test1($xmlfile,$xslfile) - { - $xh = xslt_create(); - xslt_set_object($xh,$this); - $handlers = array('get_all'=> 'handle_getall'); - xslt_set_scheme_handlers($xh,$handlers); - $res = xslt_process($xh,$xmlfile,$xslfile); - xslt_free($xh); - return 1; - } - - // this function will pass this object as in set_scheme_handler - function test2($xmlfile,$xslfile) - { - $xh = xslt_create(); - $handlers = array('get_all'=> array(&$this,'handle_getall2')); - xslt_set_scheme_handlers($xh,$handlers); - $res = xslt_process($xh,$xmlfile,$xslfile); - xslt_free($xh); - return 1; - } - function handle_getall($xh,$scheme,$rest) - { - $this->_success = true; - $rest = substr($rest,2); - return implode('', file('ext/xslt/tests/'.$rest)); - } - function handle_getall2($xh,$scheme,$rest) - { - $this->_success2 = true; - $rest = substr($rest,2); - return implode('', file('ext/xslt/tests/'.$rest)); - } - function testSucceeded() - { - return $this->_success; - } - function test2Succeeded() - { - return $this->_success2; - } -} - -$xmlfile = 'ext/xslt/tests/test.xml'; -$xslfile = 'ext/xslt/tests/xslt_set_object.xsl'; - -$testobj = new XSLTTester(); -$testobj->test1($xmlfile,$xslfile); - -$testobj->test2($xmlfile,$xslfile); - -if ($testobj->testSucceeded()) - print "OK\n"; -else - print "FAILED\n"; - -if ($testobj->test2Succeeded()) - print "OK\n"; -else - print "FAILED\n"; - -?> ---EXPECT-- -OK -OK diff --git a/ext/xslt/tests/xslt_set_object.xsl b/ext/xslt/tests/xslt_set_object.xsl deleted file mode 100644 index 9618f42e21..0000000000 --- a/ext/xslt/tests/xslt_set_object.xsl +++ /dev/null @@ -1,3 +0,0 @@ -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> -<xsl:import href="http://param.xsl" /> -</xsl:stylesheet> diff --git a/ext/xslt/tests/xslt_set_scheme_handlers-001.phpt b/ext/xslt/tests/xslt_set_scheme_handlers-001.phpt deleted file mode 100644 index c8b7b236f2..0000000000 --- a/ext/xslt/tests/xslt_set_scheme_handlers-001.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Set a non-existing scheme handler ---SKIPIF-- -<?php include("skipif.inc"); ?> ---FILE-- -<?php -function bar() -{ - return 1; -} -$xh = xslt_create(); -$xmlstring = '<foo><barred /></foo>'; -$xslstring = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/1999/XSL/Transform"><xsl:for-each select="/"><xsl:value-of select="document(\'bogus://foo\')" /></xsl:for-each></xsl:stylesheet>'; -xslt_set_scheme_handlers($xh, array('get_all' => 'foo')); -$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring)); -xslt_free($xh); -echo("OK"); -?> ---EXPECT-- -OK diff --git a/ext/xslt/tests/xslt_set_scheme_handlers-002.phpt b/ext/xslt/tests/xslt_set_scheme_handlers-002.phpt deleted file mode 100644 index 3658b378a1..0000000000 --- a/ext/xslt/tests/xslt_set_scheme_handlers-002.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -Override Sablotron file handler ---SKIPIF-- -<?php -include("skipif.inc"); -if(!defined("XSLT_SABOPT_FILES_TO_HANDLER")) { - die("skip Sab CVS > 20021031 needed"); -} -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -function handle_files_all($xh, $proto, $rest_uri) -{ - $error = "Cannot resolve $proto:$rest_uri on handle $xh"; - - if($proto != 'file') - return $error; - - $rest_uri = substr($rest_uri, 2); // strip protocol separators // - if(substr($rest_uri, 0, 1) == '/') - { - return (file_exists($rest_uri)) ? implode('', file($rest_uri)) : $error; - } - else - { - $f = dirname(__FILE__) . '/' . $rest_uri; - return (file_exists($f)) ? implode('', file($f)) : $error; - } -} - -$xh = xslt_create(); -xslt_setopt($xh, XSLT_SABOPT_FILES_TO_HANDLER); -$xmlstring='<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE qa SYSTEM "file://qa.dtd"> -<qa> - <test type="simple">PHP QA</test> -</qa>'; -$xslstring='<?xml version="1.0" encoding="ISO-8859-1"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" /> - <xsl:param name="insertion">Test failed</xsl:param> - <xsl:template match="/qa"> - <xsl:apply-templates select="test" /> - </xsl:template> - <xsl:template match="test"> - <xsl:value-of select="concat(@type, \': \', .)" /> - </xsl:template> -</xsl:stylesheet>'; -xslt_set_scheme_handlers($xh, array('get_all' => 'handle_files_all')); -$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring)); -echo $result; -xslt_free($xh); -?> ---EXPECT-- -simple: PHP QA diff --git a/ext/xslt/tests/xslt_set_scheme_handlers-003.phpt b/ext/xslt/tests/xslt_set_scheme_handlers-003.phpt deleted file mode 100644 index c5bca5c0b6..0000000000 --- a/ext/xslt/tests/xslt_set_scheme_handlers-003.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -Core dump when returning FALSE in a handler ---SKIPIF-- -<?php -include("skipif.inc"); -if(!defined("XSLT_SABOPT_FILES_TO_HANDLER")) { - die("skip Sablotron CVS > 20021031 needed"); -} -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -function handle_files_all($xh, $proto, $rest_uri) -{ - return FALSE; -} - -$xh = xslt_create(); -xslt_setopt($xh, XSLT_SABOPT_FILES_TO_HANDLER); -$xmlstring='<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE qa SYSTEM "file://qa.dtd"> -<qa> - <test type="simple">PHP QA</test> -</qa>'; -$xslstring='<?xml version="1.0" encoding="ISO-8859-1"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:output method="text" omit-xml-declaration="yes" encoding="ISO-8859-1" /> - <xsl:param name="insertion">Test failed</xsl:param> - <xsl:template match="/qa"> - <xsl:apply-templates select="test" /> - </xsl:template> - <xsl:template match="test"> - <xsl:value-of select="concat(@type, \': \', .)" /> - </xsl:template> -</xsl:stylesheet>'; -xslt_set_scheme_handlers($xh, array('get_all' => 'handle_files_all')); -/* This is intended to be silent! - * The result is known to be invalid, but if it doesn't core dump, the test - * has succeeded. */ -$result = @xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, array('/_xml' => $xmlstring, '/_xsl' => $xslstring)); -echo "OK"; -xslt_free($xh); -?> ---EXPECT-- -OK - diff --git a/ext/xslt/tests/xslt_setopt.phpt b/ext/xslt/tests/xslt_setopt.phpt deleted file mode 100644 index ce45c46e1c..0000000000 --- a/ext/xslt/tests/xslt_setopt.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -xslt_setopt function and public entities ---SKIPIF-- -<?php -include("skipif.inc"); -if(!function_exists('xslt_setopt')) { - die("skip function xslt_setopt() is not available\n"); -} -?> ---INI-- -magic_quotes_runtime=0 ---FILE-- -<?php -error_reporting(E_ALL); -$xmlfile = dirname(__FILE__).'/public.xml'; -$xslfile = dirname(__FILE__).'/args.xsl'; - -$xh = xslt_create(); -// Tell Sablotron to process public entities -xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES); - -$result = xslt_process($xh, $xmlfile, $xslfile); -print "$result\n"; - -$xslstring = implode('', file($xslfile)); -$xslstring = str_replace('method="text"', 'method="html"', $xslstring); -$xslstring = str_replace('<xsl:value-of select="." />', '<html><head><title>foo</title></head><body><p><xsl:value-of select="." /></p></body></html>', $xslstring); -// DEBUG: print $xslstring; - -xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES | XSLT_SABOPT_DISABLE_ADDING_META); -var_dump(xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslstring))); - - -xslt_setopt($xh, XSLT_SABOPT_PARSE_PUBLIC_ENTITIES); -var_dump(xslt_process($xh, $xmlfile, 'arg:/_xsl', NULL, array('/_xsl' => $xslstring))); -// DEBUG: print "$result_meta\n"; - -xslt_free($xh); -?> ---EXPECT-- -PHP QA® -string(95) "<html> - <head> - <title>foo</title> - </head> - <body> - <p>PHP QA®</p> - </body> -</html> -" -string(172) "<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> - <title>foo</title> - </head> - <body> - <p>PHP QA®</p> - </body> -</html> -" |