php.net |  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
 [2006-09-12 19:24 UTC] shihewang at yahoo dot com
Description:
------------
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.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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


 [2006-09-12 19:28 UTC] derick@php.net
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 http://www.php.net/support.php 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:
<?php
$xml = simplexml_load_string(
'<?xml version="1.0" encoding="UTF-8" ?> 
  <error-report>  
    <error-number>38797</error-number>
  </error-report>');  
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:
"38797
38798"
I appreciate all comments. But I hope you test, too.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Dec 06 18:05:53 2022 UTC