On 30.07.2008, at 22:57, Dmitry Stogov wrote:
- remove __toString() from closures (Johannes/Dmitry)
What is wrong here?
What behavior do you prefer?
I just missed the discussion.
This was in the thread "closures questions" and later there were some
votes by Stas and Marcus in favor of its removal in the "towards 5.3
alpha1" thread.
Here is a comment by Christian about the topic:
so do we even want the toString() method?
IMHO we should drop toString from Closure.
There is one case which *may* cause problems:
function doSomething ($callback) {
if (!is_callable ($callback)) {
throw new Exception (...);
}
// special treatment
if ($callback == 'default') {
...
} else {
...
}
}
Here, the comparison of $callback with 'default' will yield a notice
that $callback couldn't be converted. The comparison will fail
correctly, of course, but it could cause some confusion. The correct
way of comparing would obviously be using ===, that won't cause these
hickups.
regards,
Lukas Kahwe Smith
[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php