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

From: Date: Mon, 29 Mar 2004 05:46:52 +0000
Subject: #26614 [Asn]: linebreaks in CDATA sections ignored in line count
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-56996@lists.php.net to get a copy of this message
ID: 26614 Updated by: hholzgra@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: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#56996) next »