-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
Description
see sebastianbergmann/phpunit#5844
set_error_handler (and set_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:
...
Fatal error: Uncaught Error: Invalid callback Foo\SomeExternalDependency::logError, cannot access private
method Foo\SomeExternalDependency::logError()
...
But I expected this output instead:
Fatal error: Uncaught TypeError: set_error_handler(): Argument #1 ($callback) must be a valid globally
callable callback or null, Foo\SomeExternalDependency::logError() method is private"
...
kkmuffme