public function show_php_error($severity, $message, $filepath, $line) { $ci =& get_instance(); // this allows different params for different environments $ci->config->load('email_php_errors'); // if it's enabled if (config_item('email_php_errors')) { // set up email with config values $ci->load->library('email'); $ci->email->from(config_item('php_error_from')); $ci->email->to(config_item('php_error_to')); // set up subject $subject = config_item('php_error_subject'); $subject = $this->_replace_short_tags($subject, $severity, $message, $filepath, $line); $ci->email->subject($subject); // set up content $content = config_item('php_error_content'); $content = $this->_replace_short_tags($content, $severity, $message, $filepath, $line); // set message and send $ci->email->message($content); $ci->email->send(); } $msg = 'Severity: ' . $severity . ' --> ' . $message . ' ' . $filepath . ' ' . $line; // do the rest of the codeigniter stuff parent::show_php_error($severity, $message, $filepath, $line); }
public function show_php_error($severity, $message, $filepath, $line) { require_once APPPATH . 'helpers/response_helper.php'; if (ResponseIsJson()) { ResponseCrossSite(['error' => ['message' => $message, 'file' => $filepath, 'line' => $line, 'severity' => $severity]], 403); } else { $OUT =& load_class('output', 'core'); $OUT->set_content_type('text/html'); parent::show_php_error($severity, $message, $filepath, $line); } }
function show_php_error($severity, $message, $filepath, $line) { if (!is_null($CI =& get_instance())) { $error_data['severity'] = $severity; $error_data['message'] = $message; $error_data['filepath'] = $filepath; $error_data['line'] = $line; $CI->load->helper('email'); report_error('error_php', $error_data); } return parent::show_php_error($severity, $message, $filepath, $line); }
/** * PHP error handler * * Overriding the error handler to be a little more efficient/helpful. * When executed on a dev/staging environment we want the normal error reporting * but when executed on a production box we want errors to be logged to the DB and * any output muted. Sever errors should generate an exception in the CodeBase project * * @access private * @param string a message to pass to the view, if any * @param boolean whether to log the error or not * @return void */ function show_php_error($severity, $message, $filepath, $line) { $_temp = new stdClass(); $_temp->severity = $severity; $_temp->message = $message; $_temp->filepath = $filepath; $_temp->line = $line; // -------------------------------------------------------------------------- $this->error_has_occurred = TRUE; $this->recent_errors[] = $_temp; // -------------------------------------------------------------------------- unset($_temp); // -------------------------------------------------------------------------- return parent::show_php_error($severity, $message, $filepath, $line); }
/** * Native PHP error handler * * @access private * @param string the error severity * @param string the error string * @param string the error filepath * @param string the error line number * @return string */ function show_php_error($severity, $message, $filepath, $line) { if ($this->input->is_ajax_request()) { $severity = !isset($this->levels[$severity]) ? $severity : $this->levels[$severity]; $filepath = str_replace("\\", "/", $filepath); // For safety reasons we do not show the full file path if (FALSE !== strpos($filepath, '/')) { $x = explode('/', $filepath); $filepath = $x[count($x) - 2] . '/' . end($x); } if (ob_get_level() > $this->ob_level + 1) { ob_end_clean(); } ob_start(); include APPPATH . 'errors/error_php.php'; $msg = ob_get_contents(); ob_end_clean(); $this->output->cleanup()->error(500, $msg); } else { parent::show_php_error($severity, $message, $filepath, $line); } }
function show_php_error($severity, $message, $filepath, $line) { return parent::show_php_error($severity, $message, $filepath, $line); }
/** * Exception Handler * * This is the custom exception handler we defined at the * top of this file. The main reason we use this is permit * PHP errors to be logged in our own log files since we may * not have access to server logs. Since this function * effectively intercepts PHP errors, however, we also need * to display errors based on the current error_reporting level. * We do that with the use of a PHP error template. * * @access private * @return void */ function _exception_handler($severity, $message, $filepath, $line) { global $config; // We don't bother with "strict" notices since they will fill up // the log file with information that isn't normally very // helpful. For example, if you are running PHP 5 and you // use version 4 style class functions (without prefixes // like "public", "private", etc.) you'll get notices telling // you that these have been deprecated. if ($severity == E_STRICT) { return; } // Send the PHP error to the log file... if (!class_exists('CI_Exceptions')) { include_once BASEPATH . 'libraries/Exceptions.php'; } $error = new CI_Exceptions(); // Should we display the error? // We'll get the current error_reporting level and add its bits // with the severity bits to find out. if (($severity & error_reporting()) == $severity) { $error->show_php_error($severity, $message, $filepath, $line); } // Should we log the error? No? We're done... if ($config['log_errors'] === FALSE) { return; } $error->log_exception($severity, $message, $filepath, $line); }
public function show_php_error($severity, $message, $filepath, $line) { self::log_exception($severity, $message, $filepath, $line); parent::show_php_error($severity, $message, $filepath, $line); }