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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
5 + 24 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC