php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #45628 set_error_handler() return type wrongly documented
Submitted: 2008-07-25 14:24 UTC Modified: 2008-11-01 06:11 UTC
From: sebastian@php.net Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sebastian@php.net
New email:
PHP Version: OS:

 

 [2008-07-25 14:24 UTC] sebastian@php.net
Description:
------------
The documentation for set_error_handler() seems to be wrong:

<?php
function handler($errno, $errstr, $errfile, $errline, $errcontext) {}

var_dump(set_error_handler('handler'));
var_dump(set_error_handler('handler'));

NULL
string(7) "handler"

So NULL is not used for errors. NULL means the default error handler
here apparently. Whereas the documentation reads:

"Returns a string containing the previously defined error handler (if
any), or NULL on error. If the previous handler was a class method,
this function will return an indexed array with the class and the
method name."

The code reads:

"Returns the previously defined error handler, or false on error."


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-25 14:35 UTC] sebastian@php.net
The code is broken for the error case, the docs are broken for the "not set" case.
 [2008-11-01 06:11 UTC] kalle@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:10 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=bc81b2bc296d347894439cdb179e7c3b50f339cc
Log: Fixed #45628 (set_error_handler() return type wrongly documented)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 15:00:02 2026 UTC