php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21690 error handling
Submitted: 2003-01-16 11:34 UTC Modified: 2003-01-16 11:39 UTC
From: mazsolt at yahoo dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.2.1 OS: windows
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: mazsolt at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-01-16 11:34 UTC] mazsolt at yahoo dot com
I read in the documentation, that the set_error_handler function helps us to perform some actions when a critical error happens. I wrote an error handler function named myFunction and set set_error_handler("myFunction"), however it works only when a Notice or a Warning occurs. When a fatal error happens (to call an undefined function), the PHP error handler is executed:
------------------------------
<?php
function myFunction($a,$b,$c,$d){
switch($a){
 case 1: $a="Fatal error:";break;
 case 2: $a="Warning:";break;
 case 8: $a="Notice:";
}
echo "<b>$a</b> $b iniside <b>$c</b> on line<b> $d</b>";
}

set_error_handler("myFunction");
echo undef();
?>
------------------------------
The settings in the php.ini file:

; log errors = On  
; error_log = D:/inetpub/wwwroot/visit.txt
; error_log = syslog
; all three are disabled ... 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-16 11:39 UTC] hholzgra@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

see http://php.net/set_error_handler

[...]
Note:  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 and E_COMPILE_WARNING.
[...]

"undefined function" is E_ERROR
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 13:01:32 2025 UTC