|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20442 xml_get_current_line_number produces segmentation fault
Submitted: 2002-11-15 03:54 UTC Modified: 2002-11-18 07:30 UTC
From: blizz at 0x03 dot net Assigned:
Status: Closed Package: XML related
PHP Version: 4CVS-2002-11-15 OS: NetBSD 1.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: blizz at 0x03 dot net
New email:
PHP Version: OS:


 [2002-11-15 03:54 UTC] blizz at 0x03 dot 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"; 
                        while($data = fgets($fp, 4096))
                                if(!xml_parse($this->parser, $data, feof($fp)))
                                        echo 'xml_parser error: ',
                                              ' at line ',


                return $this->struct;   

If the data.xml looks like this for example :

I runned the xml example file in shell and here is the output :
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 ?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-15 16:09 UTC]
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

I am leaving the bug open, until the bunbled expat library is upgraded to the latest stable release.
 [2002-11-15 23:53 UTC] blizz at 0x03 dot net
okay, sorry. did not know that ;)
 [2002-11-18 07:30 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 21 14:03:35 2022 UTC