Bug #10743 Updated: class functions & PHP core functions inconsistently clash ;)

From: Date: Wed, 09 May 2001 09:02:59 +0000
Subject: Bug #10743 Updated: class functions & PHP core functions inconsistently clash ;)
Groups: php.dev 
Request: Send a blank email to php-dev+get-54471@lists.php.net to get a copy of this message
ID: 10743 Updated by: hholzgra Reported By: jjones@net-conex.com Old-Status: Bogus Status: Open Old-Bug Type: Scripting Engine problem Bug Type: Feature/Change Request Operating system: PHP Version: 4.0.4pl1 Assigned To: Comments: 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 Previous Comments: --------------------------------------------------------------------------- [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@net-conex.com Okay.. this has been bugging me for a while.. consider the following: class test { function mail () { print ("Bahn"); } function fopen () { print ("Bahn"); } function new () { print ("Bahn"); } function list () { print ("Bahn"); } } $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?! --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10743&edit=2

« previous php.dev (#54471) next »