ID:               26614
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 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] [EMAIL PROTECTED]

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

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

[2003-12-13 09:11:38] [EMAIL PROTECTED]

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

Reply via email to