From: swquinn at gmail dot com
Operating system: Windows XP Professional
PHP version: 5.3.0
PHP Bug Type: Scripting Engine problem
Bug description: Inclusion of token/syntax keyword in namespace causes Parse
error
Description:
------------
Using a PHP language token, or syntactic keyword within a namespace causes
a Parse error to be thrown by PHP. There is no documentation anywhere (that
I could find) indicating whether keywords are permitted as part of a
namespace name.
If they are not, it would be nice if this is documented.
If they should be, then this is clearly a defect.
It would be _nice_ a keyword could contain any words (language syntax or
otherwise).
Reproduce code:
---------------
<?php
namespace my\default\ns;
class Foo {
public function bar() {
return 0;
}
}
$foo = new Foo();
echo $foo->bar();
?>
Expected result:
----------------
0
Actual result:
--------------
Parse error: syntax error, unexpected T_DEFAULT, expecting T_STRING in
D:\PHP\tests\test.php on line 2
--
Edit bug report at http://bugs.php.net/?id=49982&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49982&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49982&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49982&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49982&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49982&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49982&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49982&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49982&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49982&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49982&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49982&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49982&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49982&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49982&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49982&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49982&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49982&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49982&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49982&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49982&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49982&r=mysqlcfg