From:             sergey at bds dot ru
Operating system: Windows
PHP version:      4.3.2
PHP Bug Type:     XML related
Bug description:  Section CDATA is not recognized by the parser

Description:
------------
When parse_xml_into_structure parses an xml, it seems for me that it skips
the CDATA section. 
Parser assumes the CDATA node as an usual value of its node.
But, it should be actually parsed into a new child node - CDATA section

Reproduce code:
---------------
test.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<PlaceHolderList>
<![CDATA[
function fnShow()
{

}
]]>
</PlaceHolderList>

test.php
$strXml      = implode("", file("test.xml"));
$objParser   = xml_parser_create();
xml_parser_set_option($objParser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($objParser, XML_OPTION_SKIP_WHITE,   1);
xml_parse_into_struct($objParser, $strXml, $arrParserValues,
$arrParserIndexes);
print_r($arrParserValues);

Expected result:
----------------
Array
(
    [0] => Array
        (
            [tag] => PlaceHolderList
            [type] => complete
            [level] => 1
            [value] => 
    [1] => Array
        (
            [tag] => PlaceHolderList
            [type] => cdata
            [level] => 2
            [value] => function fnShow(){    var aAll = document.all;   
var e = new Enumerator(aAll);    while (!e.atEnd())    {>        alert
(e.item());        e.moveNext();    }}
        )

)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [tag] => PlaceHolderList
            [type] => complete
            [level] => 1
            [value] => function fnShow(){    var aAll = document.all;   
var e = new Enumerator(aAll);    while (!e.atEnd())    {>        alert
(e.item());        e.moveNext();    }}
        )

)

-- 
Edit bug report at http://bugs.php.net/?id=26188&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26188&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26188&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26188&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26188&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26188&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26188&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26188&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26188&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26188&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26188&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26188&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26188&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26188&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26188&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26188&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26188&r=float

Reply via email to