php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27148 a keyword (like print) is not allowed as method name
Submitted: 2004-02-04 13:07 UTC Modified: 2004-02-06 03:43 UTC
From: andrey@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2004-02-05 (dev) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andrey@php.net
New email:
PHP Version: OS:

 

 [2004-02-04 13:07 UTC] andrey@php.net
Description:
------------
PHP5 (HEAD) complains when a class has a method named print(). Looks like the yacc grammar have to modified to allow that. The example code works without problems with 4.3.5-dev

Reproduce code:
---------------
php -r 'class a { function print(){}}'

Expected result:
----------------
no error

Actual result:
--------------
PHP Parse error:  parse error, unexpected T_PRINT, expecting T_STRING in Command line code on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-05 16:18 UTC] andrey@php.net
print, echo, die ...
 [2004-02-05 20:53 UTC] alan_k@php.net
/home/alan# php -r 'class a { function print(){}}'
 
Parse error: parse error, expecting `T_STRING' in Command line code on line 1
 
faxserver:/home/alan# php -v
PHP 4.3.2 (cli) (built: Jun  3 2003 11:24:43)
Copyright (c) 1997-2003 The PHP Group

I'm not sure how it could have worked with 4.3.5-dev.. - T_PRINT and the associated grammer havent changed since it was first checked into CVS....


 [2004-02-06 03:43 UTC] andrey@php.net
next time have to double check. The fault was mine (hmm).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Aug 13 05:00:03 2025 UTC