#10743 [Com]: class functions & PHP core functions inconsistently clash ;)

From: Date: Mon, 11 Aug 2003 21:21:39 +0000
Subject: #10743 [Com]: class functions & PHP core functions inconsistently clash ;)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45764@lists.php.net to get a copy of this message
ID: 10743 Comment by: destes at ix dot netcom dot com Reported By: jjones at net-conex dot com Status: Open Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.0.4pl1 New Comment: yes, but couldn't any later calls to those new() and list() functions result in parsing clashes? If so, perhaps the error message should be clarified. That's one of the few glaring insufficiencies in PHP right now - the clarity of its errors, especially its parse errors. If the parser isn't going to be made intelligent enough to allow you to make functions like a new() or list() - and I can see the argument, considering some language constructs can be invoked using function syntax - then at least make a prettier error message =) -Steve Previous Comments: ------------------------------------------------------------------------ [2001-05-09 05:02:59] hholzgra@php.net IMHO the parser should be clever enough to get the clue when using new() or list() in a class/method context that these can't be referencing the language constructs here moved to feature requests ------------------------------------------------------------------------ [2001-05-09 03:52:20] derick@php.net New and list are language contructs, and not functions in PHP. That's why those don't work. This is not a bug, so bugusfying this report. ------------------------------------------------------------------------ [2001-05-09 03:42:00] jjones at net-conex dot com Okay.. this has been bugging me for a while.. consider the following: class test { function mail () { print ("Bah\n"); } function fopen () { print ("Bah\n"); } function new () { print ("Bah\n"); } function list () { print ("Bah\n"); } } $temp = new test; $temp->mail(); etc, etc.. This will generate a parse error (expecting `T_STRING') until the new() and list() functions are removed from the class. mail() and fopen() will work. Now.. my question is why the inconsistency? Is there some super-secret reasoning behind not letting me name my classes' objects the same as only a few predefined functions? I'm lazy.. you guys took all the good function names.. why must you tease me with them?! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=10743&edit=1

« previous php.bugs (#45764) next »