[PHP-BUG] Bug #51525 [NEW]: Getting a node with a - in it

[email protected] ("martin at aarhof dot eu") Sat, 10 Apr 2010 03:56:22 +0200 (CEST)
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: Windows
PHP version:      5.2.13
Package:          SimpleXML related
Bug Type:         Bug
Bug description:Getting a node with a - in it

Description:
------------
If a XML node have a - in it you can't get the data from it
<display-name>

echo $channel->display-name;
Notice: Use of undefined constant name - assumed 'name'

Test script:
---------------
<?xml version="1.0" encoding="UTF-8" ?>
<tv generator-info-name="www.ontv.dk/xmltv">
  <channel id="www.ontv.dk/tv/1">
    <display-name lang="dk">DR1 DK</display-name>
  </channel>
</tv>

$xml = simplexml_load_string($xml);
$channels = $this->xml->xpath('//channel');
foreach($channels AS $channel) {
  echo $channel->display-name;
}

Expected result:
----------------
DR1 DK

Actual result:
--------------
Notice: Use of undefined constant name - assumed 'name'

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51525&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51525&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51525&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51525&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51525&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51525&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51525&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51525&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51525&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51525&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51525&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51525&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51525&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51525&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51525&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51525&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51525&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51525&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51525&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51525&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51525&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51525&r=mysqlcfg