From: [EMAIL PROTECTED]
Operating system:
PHP version: 5CVS-2003-12-13 (dev)
PHP Bug Type: XML related
Bug description: linebreaks in CDATA sections ignored in line count
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 bug report at http://bugs.php.net/?id=26614&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26614&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26614&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26614&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26614&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26614&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26614&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26614&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26614&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26614&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26614&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26614&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26614&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26614&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26614&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26614&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26614&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26614&r=float