|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38797 node name can not be "-" linked
Submitted: 2006-09-12 19:24 UTC Modified: 2006-09-13 13:58 UTC
From: shihewang at yahoo dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.1.6 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: shihewang at yahoo dot com
New email:
PHP Version: OS:


 [2006-09-12 19:24 UTC] shihewang at yahoo dot com
SimpleXml is very good but a small bug. When a node name contaiing '-', will cause trouble.PHP Interpreter takes '-' as operator. For example, when set a value to node named "operating-system":
 $xml->operating-system = "Windows";
PHP5 interpreter will report Parse error.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-12 19:27 UTC]
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.

 [2006-09-12 19:28 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

 [2006-09-13 13:58 UTC] shihewang at yahoo dot com
Please run the following code to see if it is a bug:
$xml = simplexml_load_string(
'<?xml version="1.0" encoding="UTF-8" ?> 
echo $xml->error-number .'<br>';
$xml->error-number = "38798";
echo $xml->error-number;
The message is:
"Parse error: parse error, unexpected '=' in /cgi-bin/testSimpleXML.php on line 8"
If I replace "error-number" with "error_number",
the changed code works and output:
I appreciate all comments. But I hope you test, too.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 02:01:32 2024 UTC