ID: 34916
Updated by: [EMAIL PROTECTED]
Reported By: ndb1974 at yahoo dot co dot uk
-Status: Open
+Status: Bogus
Bug Type: SimpleXML related
Operating System: UNIX
PHP Version: 5.0.5
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-10-19 15:17:43] 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).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34916&edit=1