php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34916 php 5.05/libXML 2.6.9 string variable fault
Submitted: 2005-10-19 15:17 UTC Modified: 2005-10-19 15:32 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ndb1974 at yahoo dot co dot uk Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.5 OS: UNIX
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: ndb1974 at yahoo dot co dot uk
New email:
PHP Version: OS:

 

 [2005-10-19 15:17 UTC] ndb1974 at yahoo dot co dot uk
Description:
------------
php 5.0.4 contains libXML 2.6.11

This works appears to work correctly with text string variables


php 5.05 contains libXML 2.6.9 (not sure why it contains an older libXML)

This version combination contains a fault where XML string content containing apostrophes (') is corrupted when reading or writing XML variables using simpleXML. The XML functionality tries to escape the apostrophe with several backspaces, corrupting the string when it is processed. But this does NOT happen with libXML 2.6.11.


Reproduce code:
---------------
Store an XML doc like:

<testdoc>
  <testvar>Something's not right with ' chars</testvar>
</testdoc>


Open it with a php script like:

$dom = new DomDocument;
$xml = simplexml_load_file($XMLTestDoc);
	
$XMLpath = $xml -> xpath("/testdoc");
	
$teststring = $XMLpath[0] -> testvar;
echo ($teststring);



Expected result:
----------------
Should see same string again.

Actual result:
--------------
String is displayed like:

Something\\\\'s not right with \\\' chars

(i.e. corrupted with backslashes).



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-19 15:22 UTC] derick@php.net
PHP doesn't contain any libxml at all... it uses the one installed on your system. Please upgrade to the latest and it should work fine.
 [2005-10-19 15:23 UTC] rrichards@php.net
libxml2 is not distributed with PHP (windows build being exception). Upgrade your libxml2 library then.
 [2005-10-19 15:27 UTC] ndb1974 at yahoo dot co dot uk
But is it libXML that the following PHP5 code relies on

$xml = simplexml_load_file($XMLTestDoc);
	
$XMLpath = $xml -> xpath("/testdoc");
	
$teststring = $XMLpath[0] -> testvar;

????
 [2005-10-19 15:32 UTC] derick@php.net
Please read our statements again, we do NOT bundle libxml2. Please install the proper library on your system.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC