php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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"; 
                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 ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-15 16:09 UTC] 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 23:53 UTC] blizz at 0x03 dot net
okay, sorry. did not know that ;)
 [2002-11-18 07:30 UTC] iliaa@php.net
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 http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

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


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 18:03:34 2021 UTC