php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10934 set_error_handler () is not catching all errors
Submitted: 2001-05-17 13:12 UTC Modified: 2001-06-19 22:46 UTC
From: melissa at everseek dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Solaris 8
Private report: No CVE-ID: None
 [2001-05-17 13:12 UTC] melissa at everseek dot com
Short, sample function listed to quickly illustrate issue:

[root@helpdesk bin]# more err.php 
<?php
function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) {
echo "USER ERROR HANDLER:";
echo " -- errno:$errno";
echo " -- errmsg:$errmsg";
echo " -- filename:$filename";
echo " -- linenum:$linenum";
echo "\n";
}

$old_error_handler = set_error_handler("userErrorHandler");

trigger_error("E_USER_ERROR", E_USER_ERROR);
trigger_error("E_USER_WARNING", E_USER_WARNING);
trigger_error("E_USER_NOTICE", E_USER_NOTICE);
this_function_does_not_exist();
?>

[root@helpdesk bin]# ./php -q err.php 
USER ERROR HANDLER: -- errno:256 -- errmsg:E_USER_ERROR -- filename:err.php -- linenum:13
USER ERROR HANDLER: -- errno:512 -- errmsg:E_USER_WARNING -- filename:err.php -- linenum:14
USER ERROR HANDLER: -- errno:1024 -- errmsg:E_USER_NOTICE -- filename:err.php -- linenum:15
<br>
<b>Fatal error</b>:  Call to undefined function:  this_function_does_not_exist() in <b>err.php</b> on line <b>16</b><br>
[root@helpdesk bin]# 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-19 22:46 UTC] sniper@php.net
Yes, this is how it supposed to work. Fatal errors
are always outputted via the default error handler.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 06:01:26 2024 UTC