php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35247 setParameter not set if value contains single quote character ' on Windows
Submitted: 2005-11-16 21:06 UTC Modified: 2005-11-18 22:51 UTC
Votes:9
Avg. Score:4.0 ± 0.9
Reproduced:7 of 8 (87.5%)
Same Version:2 (28.6%)
Same OS:2 (28.6%)
From: junkmail at eighteyes dot com Assigned:
Status: Wont fix Package: XSLT related
PHP Version: 5.0.5 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: junkmail at eighteyes dot com
New email:
PHP Version: OS:

 

 [2005-11-16 21:06 UTC] junkmail at eighteyes dot com
Description:
------------
This error ocurs when the value of the parameter set with setParameter contains:
- an xml/html tag with an attribute
- a single quote character in the tag's value

The parameter value will not be set. The function doesn't return FALSE either, making you think the value was successfully set. This only happens on my Windows setup, not in Linux.

If the tag doesn't contain an attribute, or the tag's value doesn't contain a single quote, the error does not occur.

Reproduce code:
---------------
$xml = new DOMDocument();
$xml->loadXML('<root></root>');

$xsl=new DOMDocument();
$xsl->loadXML('<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="parameter">ERROR</xsl:param><xsl:template match="/"><xsl:value-of select="$parameter" /></xsl:template></xsl:stylesheet>');

$list = <<<END
<p id="34">/CONCEPTS/God/Krishna's Incarnations/</p>
END;

$xslt = new XSLTProcessor();
$xslt->setParameter('', 'parameter', $list);
$xslt->importStyleSheet($xsl);
print $xslt->transformToXML($xml);

Expected result:
----------------
<p id="34">parameter's value</p>


Actual result:
--------------
ERROR

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-16 21:08 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-11-17 06:52 UTC] chregu@php.net
Can you also check the libxslt and libxml2 version? And if 
possible upgrade to the latest releases.
 [2005-11-17 12:28 UTC] rrichards@php.net
Chregu, This shouldn't work on any platform if I am correct. In PHP 5.1 a warning is explicity issued as this case is specifically tested in XSL extension:
Warning: XSLTProcessor::transformToXml(): Cannot create XPath expression (string contains both quote and double-quotes)
 [2005-11-17 16:26 UTC] chregu@php.net
Right :) It generates a warning even in 5.0.x

-> Wont fix
 [2005-11-18 22:39 UTC] junkmail at eighteyes dot com
I beg to differ. It is valid XML, and it doesn't generate a warning in 5.0.5. It's valid XML, so why should it generate a warning? And more importantly to PHP, why does it work in Linux, but not in Windows?

I have not tried the CVS on windows since I don't have a non-production machine I can test it on.

My Linux version of libxml2: 2.6.22
My Linux version of libxslt: 1.1.15

Windows version of libxml2: 2.6.11
Windows version of libxslt: 1.1.7

Will upgrade and try see if that solves the issue.

Cheers,
  Balarama Bosch
 [2005-11-18 22:51 UTC] junkmail at eighteyes dot com
Apparently the windows build of PHP5 has libxml2 and libxslt compiled in, so it doesn't look like I can update those to a later version.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 04:01:27 2024 UTC