#26614 [Asn]: linebreaks in CDATA sections ignored in line count
ID: 26614
Updated by: rrichards@php.net
Reported By: hartmut@php.net
Status: Assigned
Bug Type: XML related
Operating System: *
PHP Version: 5CVS-2004-03-15
Assigned To: sterling
New Comment:
line numbering is fixed with libxml cvs. will be released in 2.6.9.
column and byte position still an issue
Previous Comments:
------------------------------------------------------------------------
[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)