Edit report at http://bugs.php.net/bug.php?id=51709&edit=1
ID: 51709 Updated by: s...@php.net Reported by: razvan dot gavril at gmail dot com Summary: Naming a class method using a reserved keyword causes a parser error -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Ubuntu 10.04 LTS PHP Version: 5.3.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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