I'm trying to setup error handling for the first time.
It does actually work and report errors if there is one, but for some reason it always shows errors of 'missing arguments' for the error handling function itself. Please note my error handling function is in a separate file and is included to the index page, I'm not sure if that's the problem :S
Here is my error handling function
function errorHandler($errno, $errstr, $error_file, $error_line) {
if(isset($errstr)) {
# There is an error, display it
echo $errno." - ".$errstr." in ".$error_file." at line ".$error_line."<br>";
} else {
# There isn't any error, do nothing
return false;
}
}
// We must tell PHP to use the above error handler.
set_error_handler("errorHanlder");
Here is the index page
<!-- # Error Handler -->
<? if(errorHandler()) { ?>
<section id="error-handler">
<?=errorHandler();?>
</section>
<? } ?>
Here is the result in the browser (bear in mind there is no php error, so this error handler shouldn't be outputting anything - this is what I can't understand
2 - Missing argument 1 for errorHandler(), called in index.php on line 20 and defined in inc/arcError.fnc.php at line 10
2 - Missing argument 2 for errorHandler(), called in index.php on line 20 and defined in inc/arcError.fnc.php at line 10
2 - Missing argument 3 for errorHandler(), called in index.php on line 20 and defined in inc/arcError.fnc.php at line 10
2 - Missing argument 4 for errorHandler(), called in index.php on line 20 and defined in inc/arcError.fnc.php at line 10
Any idea's why PHP is reporting the missing arguments?