Doc #80021 [NEW]: set_error_handler documentation
| From: | rsutman at gmail dot com | Date: | Wed, 26 Aug 2020 17:45:59 +0000 |
| Subject: | Doc #80021 [NEW]: set_error_handler documentation | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17815@lists.php.net to get a copy of this message | ||
From: rsutman at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:set_error_handler documentation
Description:
------------
---
From manual page: https://php.net/function.set-error-handler
---
Regarding:
"The following error types cannot be handled with a user defined
function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING,
E_COMPILE_ERROR, E_COMPILE_WARNING independent of where they were
raised, and most of E_STRICT raised in the file where
set_error_handler() is called. "
require (https://www.php.net/manual/en/function.require.php) states
"it will also produce a fatal E_COMPILE_ERROR level error."
But I'm using set_error_handler & my defined function IS handling a
failed require. I found the solution on
https://stackoverflow.com/a/14103883/802469
Test script:
---------------
https://stackoverflow.com/a/14103883/802469
Or my version (which should do it)
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline )
{
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");
require("/not/a/file");
?>
Expected result:
----------------
I think the docs just need to be updated, unless I'm misunderstanding
something. I very much like being able to catch fatal errors
--
Edit bug report at https://bugs.php.net/bug.php?id=80021&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80021&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80021&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80021&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80021&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80021&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80021&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80021&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80021&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80021&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80021&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80021&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80021&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80021&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80021&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80021&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80021&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80021&r=mysqlcfg