xref: /php-src/ext/xsl/tests/bug64137.phpt (revision 5c749ad4)
1--TEST--
2Request #64137 (XSLTProcessor::setParameter() should allow both quotes to be used)
3--EXTENSIONS--
4xsl
5--FILE--
6<?php
7
8function test(string $input) {
9    $xml = new DOMDocument;
10    $xml->loadXML('<X/>');
11
12    $xsl = new DOMDocument;
13    $xsl->loadXML('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text"/><xsl:param name="foo"/><xsl:template match="/"><xsl:value-of select="$foo"/></xsl:template></xsl:stylesheet>');
14
15    $xslt = new XSLTProcessor;
16    $xslt->importStylesheet($xsl);
17    $xslt->setParameter('', 'foo', $input);
18
19    echo $xslt->transformToXml($xml), "\n";
20}
21
22test("");
23test("a'");
24test("a\"");
25test("fo'o\"ba'r\"ba'z");
26test("\"\"\"fo'o\"ba'r\"ba'z\"\"\"");
27test("'''\"\"\"fo'o\"ba'r\"ba'z\"\"\"'''");
28
29?>
30--EXPECT--
31a'
32a"
33fo'o"ba'r"ba'z
34"""fo'o"ba'r"ba'z"""
35'''"""fo'o"ba'r"ba'z"""'''
36