ID: 31779
Updated by: [EMAIL PROTECTED]
Reported By: galg at sphera dot com
-Status: Assigned
+Status: Wont fix
Bug Type: DOM XML related
Operating System: Linux
PHP Version: 4.3.10
Assigned To: rrichards
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-02-06 07:01:13] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
[2005-01-31 16:06:24] galg at sphera dot com
Description:
------------
When I've used the following code on php 4.3.8:
The <![CDATA[ ]> section was returned as XML_CDATA_SECTION_NODE (value
4).
When i am running the same code on 4.3.10 its returned as XML_TEXT_NODE
(value 3).
Reproduce code:
---------------
<?php
$sXML = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<XML_DOC>
<![CDATA[ something inside the CDATA. ]]>
</XML_DOC>
XML;
print_r(domxml_xmltree($sXML));
?>
Expected result:
----------------
php 4.3.8 response:
=======================
domdocument Object
(
[name] => #document
[url] =>
[version] => 1.0
[encoding] => UTF-8
[standalone] => -1
[type] => 9
[compression] => -1
[charset] => 1
[0] => 4
[1] => 138008952
[children] => Array
(
[0] => domelement Object
(
[type] => 1
[tagname] => XML_DOC
[0] => 5
[1] => 138009088
[children] => Array
(
[0] => domtext Object
(
[type] => 3
[name] => #text
[content] =>
[0] => 6
[1] => 138009160
)
[1] => domcdata Object
(
[type] => 4
[content] => something inside the
CDATA.
[0] => 7
[1] => 138009320
)
[2] => domtext Object
(
[type] => 3
[name] => #text
[content] =>
[0] => 8
[1] => 138009416
)
)
)
)
)
Actual result:
--------------
php 4.3.10 response:
===========================
domdocument Object
(
[name] => #document
[url] =>
[version] => 1.0
[encoding] => UTF-8
[standalone] => -1
[type] => 9
[compression] => -1
[charset] => 1
[0] => 4
[1] => 138267176
[children] => Array
(
[0] => domelement Object
(
[type] => 1
[tagname] => XML_DOC
[0] => 5
[1] => 138267304
[children] => Array
(
[0] => domtext Object
(
[type] => 3
[name] => #text
[content] =>
something inside the CDATA.
[0] => 6
[1] => 138258296
)
)
)
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31779&edit=1