#26614 [Asn->Bgs]: linebreaks in CDATA sections ignored in line count

From: Date: Sun, 13 Feb 2005 21:54:27 +0000
Subject: #26614 [Asn->Bgs]: linebreaks in CDATA sections ignored in line count
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74001@lists.php.net to get a copy of this message
 ID:               26614
 Updated by:       sniper@php.net
 Reported By:      hartmut@php.net
-Status:           Assigned
+Status:           Bogus
 Bug Type:         XML related
 Operating System: *
 PHP Version:      5CVS-2004-03-15
 Assigned To:      sterling
 New Comment:

libxml bugs belong elsewhere..



Previous Comments:
------------------------------------------------------------------------

[2004-03-31 12:19:07] rrichards@php.net

line numbering is fixed with libxml cvs. will be released in 2.6.9.
column and byte position still an issue

------------------------------------------------------------------------

[2004-03-29 00:46:52] hholzgra@php.net

further investigation shows that not only the line number count 
is broken with CDATA but also column number and byte position
produced with libxml2 are in no way consistent with expat results

-> regression test updated

------------------------------------------------------------------------

[2003-12-13 11:04:06] hholzgra@php.net

regression test added: ext/xml/test/bug26614.phpt

------------------------------------------------------------------------

[2003-12-13 09:11:38] hartmut@php.net

Description:
------------
xml_get_current_line_number() results differ between PHP 4 (expat) and
PHP 5 (libxml2) as libxml2 seems to skip over CDATA sections when
counting source lines

Reproduce code:
---------------
<?php
$xml ='<?xml version="1.0"?>
<data>
<![CDATA[
multi
line 
CDATA
block
]]>
</data>';

function startElement($parser, $name, $attrs) {
    echo "<$name> at line ".xml_get_current_line_number($parser)."\n";
}
function endElement($parser, $name) {
    echo "</$name> at line
".xml_get_current_line_number($parser)."\n";
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_parse($xml_parser, file_get_contents("test.xml", true));
xml_parser_free($xml_parser);
?>

Expected result:
----------------
<DATA> at line 2
</DATA> at line 9


Actual result:
--------------
<DATA> at line 2
</DATA> at line 4



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26614&edit=1


Thread (6 messages)

« previous php.bugs (#74001) next »