mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

This reimplements the parameter handling. Instead of quoting the strings manually, adding them to an array, and passing that as input; use the libxslt API to pass data verbatim to the processor. This also simplifies the code a lot. Closes GH-12331.
43 lines
966 B
PHP
43 lines
966 B
PHP
--TEST--
|
|
setParameter() with null bytes
|
|
--EXTENSIONS--
|
|
xsl
|
|
--FILE--
|
|
<?php
|
|
|
|
$xslt = new XSLTProcessor();
|
|
|
|
try {
|
|
$xslt->setParameter("", "foo\0", "bar");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$xslt->setParameter("", "foo", "bar\0");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$xslt->setParameter("", [
|
|
"foo\0" => "bar",
|
|
]);
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$xslt->setParameter("", [
|
|
"foo" => "bar\0",
|
|
]);
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
XSLTProcessor::setParameter(): Argument #2 ($name) must not contain any null bytes
|
|
XSLTProcessor::setParameter(): Argument #3 ($value) must not contain any null bytes
|
|
XSLTProcessor::setParameter(): Argument #3 ($value) must not contain keys with any null bytes
|
|
XSLTProcessor::setParameter(): Argument #3 ($value) must not contain values with any null bytes
|