|  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
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
 [2005-10-19 15:17 UTC] ndb1974 at yahoo dot co dot uk
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:

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

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).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-19 15:22 UTC]
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]
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]
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: Mon Jun 24 11:01:32 2024 UTC