php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2618 XML error reporting bug
Submitted: 1999-10-27 09:10 UTC Modified: 2002-06-16 14:17 UTC
From: brad_jackson at inlet dot com Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.12 OS: Redhat Linux 5.2/6.0
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: brad_jackson at inlet dot com
New email:
PHP Version: OS:

 

 [1999-10-27 09:10 UTC] brad_jackson at inlet dot com
If there is a mismatched tag in XML and the parsing fails, when calling xml_get_current_line_number or xml_get_current_column_number, the results are not consistent between runs.  Here's a code sample and results.  I've noticed that if I initialize $done to FALSE, it doesn't happen, but I don't know how that could be related.  I also tried shortening the XML sample, but then it doesn't happen either. I've seen XML errors in the past that would cause Apache to seg fault when calling the functions to get details about the XML error and this may be the same problem.

<?php
$xml = "<ABCDEFGH>\n<ABCDEFGHIJKLM>1234567890</ABCDEFGHIJKLM>\n<ABCDEFGH>";
// Note last closing tag should be "</ABCDEFGH>"

while(!$done)
{
   for($i = 0; $i < 2; $i++)
   {
      $xmlParser = xml_parser_create();
      xml_parse($xmlParser, $xml, TRUE);
      
      $pass[$i]["Line"] = xml_get_current_line_number($xmlParser);
      $pass[$i]["Column"] = xml_get_current_column_number($xmlParser);         
      
      xml_parser_free($xmlParser);
   }
   if($pass[0]["Line"] != $pass[1]["Line"] || $pass[0]["Column"] != $pass[1]["Column"])
   {
      echo "Pass1: Line " . $pass[0]["Line"] . ", Column " . $pass[0]["Column"] . "<br>";
      echo "Pass2: Line " . $pass[1]["Line"] . ", Column " . $pass[1]["Column"];
      $done = TRUE;
   }
}
?>

Typical results:
Pass1: Line 3, Column 10
Pass2: Line 2, Column 52

Pass1: Line 1, Column 63
Pass2: Line 3, Column 10

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 14:17 UTC] sander@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC