note 104697 added to language.functions
| From: | MiguelPrez at osu1 dot php dot net | Date: | Fri, 01 Jul 2011 06:46:44 +0000 |
| Subject: | note 104697 added to language.functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181128@lists.php.net to get a copy of this message | ||
PHP functions bite. Unlike anonymous functions, named functions are not closures and they cannot
access their static environment (i.e. no use clause).
Furthermore, the interpreter breaks miserably if you attempt to redefine a function or call an
undefined function, throwing an uncatchable error that may break your application horribly. So much
for custom error handlers.
Finally, named functions are not first-class values, and while you can set a variable to a string
with the name of the named function and use () on it to call the function, there's no real
function type for named functions, which means you can't tell function names from strings, and,
what's worse, it can be a security wart considering you may accidentally read such values from
files or user input, as they are mere strings.
----
Server IP: 80.64.47.13
Probable Submitter: 217.125.117.197
----
Manual Page -- http://www.php.net/manual/en/language.functions.php
Edit -- https://master.php.net/note/edit/104697
Del: integrated -- https://master.php.net/note/delete/104697/integrated
Del: useless -- https://master.php.net/note/delete/104697/useless
Del: bad code -- https://master.php.net/note/delete/104697/bad+code
Del: spam -- https://master.php.net/note/delete/104697/spam
Del: non-english -- https://master.php.net/note/delete/104697/non-english
Del: in docs -- https://master.php.net/note/delete/104697/in+docs
Del: other reasons-- https://master.php.net/note/delete/104697
Reject -- https://master.php.net/note/reject/104697
Search -- https://master.php.net/manage/user-notes.php