|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80165 set_exception_handler() should return false on error
Submitted: 2020-10-01 08:00 UTC Modified: 2020-10-01 08:16 UTC
From: divinity76 at gmail dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: Next Major Version OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
30 + 39 = ?
Subscribe to this entry?

 [2020-10-01 08:00 UTC] divinity76 at gmail dot com
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)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-01 08:02 UTC]
-Status: Open +Status: Feedback -Package: Unknown/Other Function +Package: Scripting Engine problem
 [2020-10-01 08:02 UTC]
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:15 UTC] 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:16 UTC]
-Status: Feedback +Status: Wont fix
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Dec 06 18:05:53 2022 UTC