mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Improve testkit for xslt.
002.phpt and 003.phpt are regression tests for reported bugs. 004.phpt has been known to cause problems in some Sab/PHP combinations. No known reports in bug db for that one. Added skip mechanism @- Added regression test for bugs #17791 and #17931 (Melvyn)
This commit is contained in:
parent
7f1ad2395d
commit
c4805ffeb1
4 changed files with 59 additions and 0 deletions
15
ext/xslt/tests/002.phpt
Normal file
15
ext/xslt/tests/002.phpt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--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
|
10
ext/xslt/tests/003.phpt
Normal file
10
ext/xslt/tests/003.phpt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--TEST--
|
||||||
|
Pass object for xslt_error_handler, bug #17931
|
||||||
|
--SKIPIF--
|
||||||
|
<?php include("skipif.inc"); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
include('xslt_set_error_handler.php');
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
OK
|
9
ext/xslt/tests/skipif.inc
Normal file
9
ext/xslt/tests/skipif.inc
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
if(!extension_loaded("xslt") && ini_get("enable_dl")) {
|
||||||
|
$dlext = (substr(PHP_OS, 0, 4) == "WIN") ? ".dll" : ".so";
|
||||||
|
@dl("xlst$dlext");
|
||||||
|
}
|
||||||
|
if(!extension_loaded("xslt")) {
|
||||||
|
die("skip\n");
|
||||||
|
}
|
||||||
|
?>
|
25
ext/xslt/tests/xslt_set_error_handler.php
Normal file
25
ext/xslt/tests/xslt_set_error_handler.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?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();
|
||||||
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue