Edit report at http://bugs.php.net/bug.php?id=51709&edit=1

 ID:               51709
 User updated 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:

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


Previous Comments:
------------------------------------------------------------------------
[2010-05-12 18:37:27] s...@php.net

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

Reply via email to