Created
January 1, 2011 14:25
-
-
Save thecancerus/761775 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PHPFatalError { | |
public function setHandler() | |
{ | |
register_shutdown_function('handleShutdown'); | |
} | |
} | |
function handleShutdown() | |
{ | |
if (($error = error_get_last())) { | |
$buffer = ob_get_contents(); | |
ob_clean(); | |
# raport the event, send email etc. | |
$msg= $buffer; | |
$um ='We have found some error please try again later.'; | |
ob_start(); | |
$data=array(); | |
$CI = get_instance(); | |
if(!$CI->config->item('DEBUG_PRINT')) | |
{ | |
$msg=''; | |
} | |
$data['print_msg'] =$msg; | |
$data['um'] = $um; | |
load_page('exception',$data); | |
$buffer = ob_get_contents(); | |
ob_end_clean(); | |
echo $buffer; | |
exit(); | |
# from /error-capture, you can use another redirect, to e.g. home page | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment