-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set_error_handler
should accept "only globally callable callback"
#14494
Comments
I don't think that's the solution, we could just convert the callable to a proper closure. |
Do you mean accepting only The linked issue is about restoring the handler, but this issue is about |
Against it. Here's an example of why this matters and is more important than ever to allowe non-public methods: |
|
But it cannot be added back to the error handler callstack once it has been removed (from outside context) |
Good clear point, but if |
Could you provide an example of what you mean, bc it's not fully clear to me |
That's true but the instance of |
I would consider a pull requests that implements this, of course. |
Description
see sebastianbergmann/phpunit#5844
set_error_handler
(andset_exception_handler
, maybe even more handlers) should accept only callables callable from any context. Accepting any callable like php does not is dangerous and unwanted, the error/exception can from any context.I would expect php to evaluate "if the callable is callable" in global context on set phase.
repro: https://3v4l.org/mZ9E3
Resulted in this output:
But I expected this output instead:
The text was updated successfully, but these errors were encountered: