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

This parameter never actually did anything and was forgotten about. We solve this by detecting when we have a $namespace argument (that won't conflict with the name argument) and creating a Clark notation name out of it. Closes GH-16123.
59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
--TEST--
|
|
Request #30622 (XSLT: xsltProcessor->setParameter() cannot set namespace URI) - error cases
|
|
--EXTENSIONS--
|
|
xsl
|
|
--CREDITS--
|
|
Based on a test by <ishikawa at arielworks dot com>
|
|
--FILE--
|
|
<?php
|
|
|
|
$proc = new XSLTProcessor();
|
|
|
|
try {
|
|
$proc->setParameter("urn:x", "{urn:a}x", "");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$proc->setParameter("urn:x", "a:b", "");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$proc->getParameter("urn:x", "{urn:a}x");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$proc->getParameter("urn:x", "a:b");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$proc->removeParameter("urn:x", "{urn:a}x");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
$proc->removeParameter("urn:x", "a:b");
|
|
} catch (ValueError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
// Edge cases, should work
|
|
$proc->setParameter("urn:x", ":b", "");
|
|
$proc->setParameter("urn:x", ":", "");
|
|
|
|
?>
|
|
--EXPECT--
|
|
XSLTProcessor::setParameter(): Argument #2 ($name) must not use clark notation when argument #1 ($namespace) is not empty
|
|
XSLTProcessor::setParameter(): Argument #2 ($name) must not be a QName when argument #1 ($namespace) is not empty
|
|
XSLTProcessor::getParameter(): Argument #2 ($name) must not use clark notation when argument #1 ($namespace) is not empty
|
|
XSLTProcessor::getParameter(): Argument #2 ($name) must not be a QName when argument #1 ($namespace) is not empty
|
|
XSLTProcessor::removeParameter(): Argument #2 ($name) must not use clark notation when argument #1 ($namespace) is not empty
|
|
XSLTProcessor::removeParameter(): Argument #2 ($name) must not be a QName when argument #1 ($namespace) is not empty
|