Ask a Question related to PHP Development, Design and Development.
-
destes at ix dot netcom dot com #1
#10743 [Com]: class functions & PHP core functions inconsistently clash ;)
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] [email]hholzgra@php.net[/email]
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] [email]derick@php.net[/email]
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 [url]http://bugs.php.net/?id=10743&edit=1[/url]
destes at ix dot netcom dot com Guest
-
#40765 [NEW]: calling backtrace inside nested static class functions causes segfault
From: ndroege at bimp dot de Operating system: linux debian PHP version: 5.2.1 PHP Bug Type: Reproducible crash Bug... -
Add functions to the String Class
Greetings! I am trying to create my own class file to add functions to the intrinsic String Class (things like trim, etc.). Is there any way to... -
#25652 [Opn->Ver]: Calling Global functions dynamically fails from Class scope
ID: 25652 Updated by: sniper@php.net Reported By: john@php.net -Status: Open +Status: Verified Bug... -
#25652 [Com]: Calling Global functions dynamically fails from Class scope
ID: 25652 Comment by: peter dot prochaska at datev dot de Reported By: john@php.net Status: Open Bug Type: ... -
How to dynamically generate functions in a class
I am having to be tasked with a rather painful task of updating an existing class by adding a dynamic amount of database field values; for each...



Reply With Quote

