Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
draft to handle error and ignore mysql deprecated error
define('DEBUG', true); // true = enable debug mode
define('DEBUG_ALLOW_ERRORS', false); // false = break on every notice/warning/error(throw exception)
// set_exception_handler(array('Kohana_Exception', 'handler'));
function error_handler($code, $error, $file = NULL, $line = NULL){
if (error_reporting() & $code)
if (in_array($code, array(512, 8192)) && preg_match('#mysql_connect#', $error) ){
return true; // return true to skip default error handler
throw new ErrorException($error, $code, 0, $file, $line);
if (function_exists('error'))
error($error.' in file "'.$file.'", line '.$line.' [errorCode '.$code.']');
return false; // return false to use default error handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.