Forum Moderators: coopster

Message Too Old, No Replies

Changing error handler

         

csdude55

5:42 pm on Sep 19, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been sending my PHP errors to MySQL instead of a text file, mainly so that I can prevent duplicates. I'm using the code from PHP.net:

function errorHandler($errno, $errstr, $errfile, $errline) {
global $dbh;

mysqli_query($dbh, sprintf("INSERT IGNORE INTO error_log VALUES('%s', '%s', '%s', '%s')",
// blah blah blah
);

return true;
}

$old_error_handler = set_error_handler('errorHandler');


[php.net...]

The question is, do I actually NEED to set it to $old_error_handler? I don't use that variable anywhere, but I read a confusing comment on there about memory leaks?