#31779 [WFx]: XML_CDATA_SECTION_NODE is returned as XML_TEXT_NODE

From: Date: Tue, 08 Feb 2005 13:22:17 +0000
Subject: #31779 [WFx]: XML_CDATA_SECTION_NODE is returned as XML_TEXT_NODE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73644@lists.php.net to get a copy of this message
ID: 31779 User updated by: galg at sphera dot com Reported By: galg at sphera dot com Status: Wont fix Bug Type: DOM XML related Operating System: Linux PHP Version: 4.3.10 Assigned To: rrichards New Comment: Hello Rob. Thanks for the update. The problem is that the updated Linux distributions are using libxml2 version 2.6 and most of the production servers which are running PHP are using the distibution binary package. Not fixing this bug means that people have to change their code lines which were written as described in the php documentation of DomXML and used to work. Please reconsider fixing this bug. Regards, Gal Previous Comments: ------------------------------------------------------------------------ [2005-02-07 22:12:12] rrichards@php.net This change was necessary as libxml 2.6 broke a bunch of domxml's xsl stuff. This would require an API change to be able to support loading CDATA. domxml behavior when using libxml 2.6+ and loading a document now converts incoming CDATA to TEXT nodes. This does not affect creating CDATA manually however. ------------------------------------------------------------------------ [2005-02-06 07:01:13] sniper@php.net Rob, can you please check this out? ------------------------------------------------------------------------ [2005-02-06 00:18:54] galg at sphera dot com It's seems to be a problem with the integration of PHP 4.3.x and libxml2 ver 2.6.x. I've tested the following php5 script on PHP 5.0.2 compiled with libxml2-2.6.11 and it worked as expected: <?php $sXML = <<<XML <?xml version="1.0" encoding="UTF-8"?> <XML_DOC> <![CDATA[ something inside the CDATA. ]]> </XML_DOC> XML; $objXML = new DOMDocument; $objXML->loadXML($sXML); foreach ($objXML->documentElement->childNodes as $child) { echo "Type: " . $child->nodeType . "\t | \t"; echo "Name: " . $child->nodeName; echo "\n"; } ?> The php5 script returns good result: the CDATA section with type 4. Could it be that the problem is an API change in the libxml2 version 2.6.x which wasn't updated in version 4.3.x of php ? The result of the script on my environment is: Type: 3 | Name: #text Type: 4 | Name: #cdata-section Type: 3 | Name: #text Regards, Gal ------------------------------------------------------------------------ [2005-02-05 16:03:04] galg at sphera dot com Made 2 more tests: I've compiled php 4.3.10 with the latest libxml2 ver 2.6.17 and still has the same problem I tried also to compile it agains version libxml2-2.5.11 and it worked as expected. The problem seems to be only with version 2.6.x of libxml2. ------------------------------------------------------------------------ [2005-02-05 14:56:23] galg at sphera dot com I've compiled now the php myself: - I compiled php 4.3.10 with libxml2-2.4.30 the result was ok as i expected to be. - I compiled php 4.3.10 with libxml2 20611 the result was the same i wrote in the bug description. Latest version of libxml2 is :2.6.17. The sources files of the libxml2 are under directory called "old" all new Linux distributions are using libxml2 version 2.6.x. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31779 -- Edit this bug report at http://bugs.php.net/?id=31779&edit=1

« previous php.bugs (#73644) next »