php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72550 xml_get_current_line_number gives wrong numbers. col too?
Submitted: 2016-07-06 00:22 UTC Modified: 2016-07-17 04:22 UTC
From: jim dot michaels at Jesusnjim dot com Assigned: cmb (profile)
Status: No Feedback Package: XML related
PHP Version: 7.1.0alpha1 OS: vista 32 amd64
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: jim dot michaels at Jesusnjim dot com
New email:
PHP Version: OS:

 

 [2016-07-06 00:22 UTC] jim dot michaels at Jesusnjim dot com
Description:
------------
./menu7a.xml: 4576:1, ERROR:No error (error may be on previous line)
don't have a small test script. this error is past end of file, which is line 4568.

Test script:
---------------
$contents = @file_get_contents($xmlFile);//for tag content replacement

$xmlArray=array();
$tags=array();
global $AcctTypes,$TagTypes,$rootTag;
//this is the list of

$parser = xml_parser_create_ns('utf-8',':'); // WORKS JUST FINE
$xmlSuccess=xml_parse_into_struct($parser, $contents, $xmlArray, $tags);
if (XML_ERROR_NONE!=xml_get_error_code($parser) || $xmlSuccess) {
	echo "-------------------------XML ERROR-------------------------\r\n".
	     "-------------------------XML ERROR-------------------------\r\n".
	     "-------------------------XML ERROR-------------------------\r\n".
		$xmlFile.': '.xml_get_current_line_number($parser).':'.
		xml_get_current_column_number($parser).', ERROR:'.
		xml_error_string(xml_get_error_code($parser)).
		" (error may be on previous line)\r\n".
	     "-------------------------XML ERROR-------------------------\r\n".
	     "-------------------------XML ERROR-------------------------\r\n".
	     "-------------------------XML ERROR-------------------------\r\n";
	xml_parser_free($parser);
	exit(1);
}
xml_parser_free($parser);


Expected result:
----------------
line number matching the problem. 
someone put random number generator in the parser/lexer?

Actual result:
--------------
./menu7a.xml: 4576:1, ERROR:No error (error may be on previous line)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-06 13:10 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-07-06 13:10 UTC] cmb@php.net
> don't have a small test script.

The supplied test script is small enough, but not self-contained.
Please provide either another script that generates the XML, or
provide the XML for download.
 [2016-07-17 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Sep 17 12:01:27 2019 UTC