|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #35963 first call to set_error_handler returns same value on success and error
Submitted: 2006-01-10 16:35 UTC Modified: -
Avg. Score:4.1 ± 0.6
Reproduced:7 of 7 (100.0%)
Same Version:4 (57.1%)
Same OS:3 (42.9%)
From: jon at fuck dot org Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.1.1 OS: gnu/linux, 2.6.14-1.1637_FC4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jon at fuck dot org
New email:
PHP Version: OS:


 [2006-01-10 16:35 UTC] jon at fuck dot org
the first call to set_error_handler returns NULL on success. on failure, e.g., if the desired callback function has not been declared, an E_WARNING is thrown and NULL is returned. this makes checking for failure of this function a little kludgy.

it would be better to always return FALSE on error, or, return the name of the internal PHP error handler on success, which is what our custom error handlers will be replacing on the first call.

by looking at previous bugs about this, it seems as though the documentation was right and the code was wrong.

Reproduce code:
function foo() { echo 'foo'; }
echo (NULL === set_error_handler('foo'));
echo (NULL === set_error_handler('bar'));

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 09:03:35 2021 UTC