|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 14:00:01 2025 UTC |
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.