Req #80165 [Opn->Fbk]: 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: Open
+Status: Feedback
Type: Feature/Change Request
-Package: Unknown/Other Function
+Package: Scripting Engine problem
PHP Version: Next Major Version
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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)