php-src/ext/xsl/tests/req30622_errors.phpt
Niels Dossche daa94cf279
Implement request #30622: make $namespace parameter functional
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.
2024-09-30 20:34:51 +02:00

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