[php-src] PR #17693: [RFC] Add get_error_handler(), get_exception_handler() functions
| From: | arnaud-lb | Date: | Tue, 04 Feb 2025 12:04:34 +0000 |
| Subject: | [php-src] PR #17693: [RFC] Add get_error_handler(), get_exception_handler() functions | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30660@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17693
Author: arnaud-lb
Currently, the only way to fetch the current error and exception handlers is to push a new one
before restoring it:
``` php
$current_error_handler = set_error_handler('valid_callback');
restore_error_handler();
```
This PR adds
get_error_handler(), get_exception_handler() functions to
address this use-case. They return the last value passed set_error_handler() or
set_exception_handler(), respectively, or NULL if no handler was set.
Related: https://github.com/symfony/symfony/pull/58372#discussion_r1773407604.