php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72472 xml_parse rejects 'tag'
Submitted: 2016-06-23 01:33 UTC Modified: 2016-06-29 09:32 UTC
From: jim dot michaels at Jesusnjim dot com Assigned:
Status: Not a bug Package: XML related
PHP Version: 7.1.0alpha1 OS: vista32,pae amd
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-06-23 01:33 UTC] jim dot michaels at Jesusnjim dot com
Description:
------------
$contents = @file_get_contents($xmlFile);//for tag content replacement

$parser = xml_parser_create_ns('utf-8',':'); // WORKS JUST FINE
$xmlArray=array();
$tags=array();
global $AcctTypes,$TagTypes,$rootTag;
//this is the list of

$xmlSuccess=xml_parse_into_struct($parser, $contents, $xmlArray, $tags);
	if (0==$StartXmlArrayIndex) {
		$StartXmlArrayIndex++;
	}
	$elem=$xmlArray[$StartXmlArrayIndex];
...


Parse error: syntax error, unexpected 'tag' (T_STRING), expecting ',' or ')' in C:\w\Jesusnjim\menu7a.php on line 472


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

$parser = xml_parser_create_ns('utf-8',':'); // WORKS JUST FINE
$xmlArray=array();
$tags=array();
global $AcctTypes,$TagTypes,$rootTag;
//this is the list of

$xmlSuccess=xml_parse_into_struct($parser, $contents, $xmlArray, $tags);
	if (0==$StartXmlArrayIndex) {
		$StartXmlArrayIndex++;
	}
	$elem=$xmlArray[$StartXmlArrayIndex];
	if (!in_array($elem['tag'],$TagTypes)) {



Expected result:
----------------
running code - sorry, complete example not possible due to 20 lines or less.


Actual result:
--------------
Parse error: syntax error, unexpected 'tag' (T_STRING), expecting ',' or ')' in C:\w\Jesusnjim\menu7a.php on line 472

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-23 02:59 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-06-23 02:59 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

That looks like a regular PHP error message. Put your code into an editor that supports syntax highlighting and see if it spots any problems.
 [2016-06-29 02:29 UTC] jim dot michaels at Jesusnjim dot com
-Status: Feedback +Status: Open
 [2016-06-29 02:29 UTC] jim dot michaels at Jesusnjim dot com
come again?
 [2016-06-29 02:33 UTC] jim dot michaels at jesusnjim dot com
the line with the problem is 
debugOut($thisFile, "printbreadcrumbsmenu", '',$elem, $iIndexArray);
 [2016-06-29 09:32 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-06-29 09:32 UTC] requinix@php.net
The error message you cite is a syntax error in your PHP code. It is not an XML parsing error. I'm going to NAB this in anticipation of you finding the problem.
http://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC