#34916 [Opn->Bgs]: php 5.05/libXML 2.6.9 string variable fault

From: Date: Wed, 19 Oct 2005 13:32:42 +0000
Subject: #34916 [Opn->Bgs]: php 5.05/libXML 2.6.9 string variable fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86741@lists.php.net to get a copy of this message
ID: 34916 Updated by: derick@php.net 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: Please read our statements again, we do NOT bundle libxml2. Please install the proper library on your system. Previous Comments: ------------------------------------------------------------------------ [2005-10-19 15:27:28] 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:23:32] rrichards@php.net libxml2 is not distributed with PHP (windows build being exception). Upgrade your libxml2 library then. ------------------------------------------------------------------------ [2005-10-19 15:22:45] 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: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

« previous php.bugs (#86741) next »