Guest User

Untitled

a guest
Jan 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. class FrontController extends FrontControllerCore
  3. {
  4. public function __construct()
  5. {
  6. # define a custom error handler so we can log PHP errors
  7. set_error_handler('_exception_handler');
  8. }
  9. }
  10.  
  11. /**
  12. * This is the custom exception handler that is declaired at the top
  13. * of Prestashop. The main reason we use this is to permit
  14. * PHP errors to be logged in Prestashop Logger system since the user may
  15. * not have access to server logs. Since this function
  16. * effectively intercepts PHP errors, however, we also need
  17. * to display errors based on the current error_reporting level.
  18. * We do that with the use of a PHP error template.
  19. *
  20. * @access private
  21. * @return void
  22. *
  23. * @param $severity
  24. * @param $message
  25. * @param $filepath
  26. * @param $line
  27. */
  28. function _exception_handler($severity, $message, $filepath, $line)
  29. {
  30. // We don't bother with "strict" notices since they tend to fill up
  31. // the log file with excess information that isn't normally very helpful.
  32. // For example, if you are running PHP 5 and you use version 4 style
  33. // class functions (without prefixes like "public", "private", etc.)
  34. // you'll get notices telling you that these have been deprecated.
  35. if ($severity == E_STRICT)
  36. {
  37. return;
  38. }
  39.  
  40. $message = $message . ' - line ' . $line . ' in '.$filepath;
  41. Logger::addLog($message, $severity, NULL, NULL, NULL, TRUE);
  42. }
Add Comment
Please, Sign In to add comment