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

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



Bug-Req #51525 [Opn]: Getting a node with a - in it

2010-04-09 Thread martin at aarhof dot eu
Edit report at http://bugs.php.net/bug.php?id=51525edit=1

 ID:   51525
 User updated by:  martin at aarhof dot eu
 Reported by:  martin at aarhof dot eu
 Summary:  Getting a node with a - in it
 Status:   Open
-Type: Bug
+Type: Feature/Change Request
 Package:  SimpleXML related
 Operating System: Windows
 PHP Version:  5.2.13

 New Comment:

Solution is

echo $channel-{display-name};



Could this be fixed so you dont need the {} ?


Previous Comments:

[2010-04-10 03:56:21] martin at aarhof dot eu

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=dkDR1 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 this bug report at http://bugs.php.net/bug.php?id=51525edit=1