Req #80165 [Fbk->Wfx]: set_exception_handler() should return false on error
Edit report at https://bugs.php.net/bug.php?id=80165&edit=1
ID: 80165
Updated by: requinix@php.net
Reported by: divinity76 at gmail dot com
Summary: set_exception_handler() should return false on error
-Status: Feedback
+Status: Wont fix
Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: Next Major Version
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2020-10-01 08:15:16] divinity76 at gmail dot com
oh nice, so it seems PHP8 throws on error, and returns null|callable on success, that's even
better, thanks,
nevermind then, this request can be closed.
------------------------------------------------------------------------
[2020-10-01 08:02:45] requinix@php.net
In PHP 8, set_exception_handler throws a TypeError for a bad callback argument. It still returns
null if successful and there was no previous handler.
------------------------------------------------------------------------
[2020-10-01 08:00:13] divinity76 at gmail dot com
Description:
------------
currently set_exception_handler() returns null on error, and null|callable on success.
so when it does return null, there's no good way to tell "did it return null because of an
error, or did it return null because of success-but-there-was-no-previous-handler ?"
.. i think it would be an improvement if it returned bool(false) on error and null|callable on
success, then it would cleanly separate error-returns from success-returns. i guess that's a
BC-break and should go in the next major version though (for scripts knowing full well that
there's a previous handler and looking for nulls to detect errors? idk if that even exist, but
i guess it might)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80165&edit=1
Thread (4 messages)