#20442 [Com]: xml_get_current_line_number produces segmentation fault
ID: 20442
Comment by: blizz@0x03.net
Reported By: blizz@0x03.net
Status: Analyzed
Bug Type: XML related
Operating System: NetBSD 1.6
PHP Version: 4CVS-2002-11-15
New Comment:
okay, sorry. did not know that ;)
Previous Comments:
------------------------------------------------------------------------
[2002-11-15 16:09:15] iliaa@php.net
This bug is actually the result of a bug in the bundled expat library.
You can fix the problem by installing the latest expat from
http://sourceforge.net/project/showfiles.php?group_id=10127&release_id=109357
I am leaving the bug open, until the bunbled expat library is upgraded
to the latest stable release.
------------------------------------------------------------------------
[2002-11-15 03:54:06] blizz@0x03.net
It looks like the xml_get_current_line_number of xml produces a
segmentation fault.
Here is the piece of code :
function parse($file)
{
if(!($fp = fopen($file, 'r')))
echo "xml_parser error: Could not open
$file.\n";
else
while($data = fgets($fp, 4096))
if(!xml_parse($this->parser, $data,
feof($fp)))
echo 'xml_parser error: ',
xml_error_string(xml_get_error_code($this->parser)),
' at line ',
xml_get_current_line_number($this->parser),
"\n";
fclose($fp);
return $this->struct;
}
If the data.xml looks like this for example :
<Example>
<Test>Bla</Test>
<Test>Muh</test>
</Example>
I runned the xml example file in shell and here is the output :
Example
Test
Test
xml_parser error: mismatched tag at line 4
xml_parser error: mismatched tag at line Segmentation fault (core
dumped)
Now where is the problem ?
Does the XML parser try to get the line and is already at the end of
the file ?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20442&edit=1
Thread (4 messages)