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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 03 20:01:29 2024 UTC