Edit report at http://bugs.php.net/bug.php?id=51709&edit=1
ID: 51709
Comment by: razvan dot gavril at gmail dot com
Reported by: razvan dot gavril at gmail dot com
Summary: Naming a class method using a reserved keyword causes
a parser error
Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Ubuntu 10.04 LTS
PHP Version: 5.3.2
New Comment:
I notice that the other bug you've pointed me to, states that the
problem
happens starting with version 5.3.2 also.
Previous Comments:
------------------------------------------------------------------------
[2010-05-12 19:05:24] razvan dot gavril at gmail dot com
Strange, I've notice the bug after updating from Ubuntu karmic. Looking
now at
the package.ubuntu.com I see that karmic came with php 5.2.10
I'm 100% sure that I didn't had this bug before the update
------------------------------------------------------------------------
[2010-05-12 18:37:27] [email protected]
I don't know what your "previous" version was, but the same error occurs
with PHP
5.1.6 so this has been a language feature for a very long time.
Also see http://bugs.php.net/51782 about the introduction of new
keywords in
recent versions.
------------------------------------------------------------------------
[2010-04-30 22:33:12] razvan dot gavril at gmail dot com
Description:
------------
Is no longer possible to name a class methods using names that are
reserved keywords like : 'break', 'for', 'goto'. It used to work with
previous php versions.
If this is a 'feature', what's the point ?
Test script:
---------------
<?php
class foo {
static function for() {
echo "1";
}
static function goto() {
echo "2";
}
}
foo::for();
foo::goto();
Expected result:
----------------
Display: 12
Actual result:
--------------
PHP Parse error: syntax error, unexpected T_FOR, expecting T_STRING in
/etc/asterisk/manager.d/test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51709&edit=1