0

In Laravel 4.2 the errors are caught and displayed on a "pretty" page, thanks to Whoops. The error is also logged in the configured log file (by default : storage/log/...).

You can be a very good developer but it happens sometimes, you forget a ;, you misspell a PHP command, a function name (or whatever) in your code that will throw a "PHP Parse Error". If it happens in the "routes.php" or in any controller of Laravel 4, the pretty Whoops page won't display and the error won't be logged by Laravel. You have to find the error logged in the default PHP log file of your server.

To reproduce the bug, make a new line in your routes.php with only "let it bug", then save the file and then load the page. Nothing displays, right? The error is only reported in the default PHP log file of your server, right?

Is this behavior normal and does this happen to you as well? Is there a way to have it caught by Whoops in Laravel?

jasonlam604
  • 1,456
  • 2
  • 16
  • 25
Dam Fa
  • 448
  • 4
  • 16
  • I get the whoops exception handler with the syntax error displayed. – lagbox Jan 27 '15 at 03:23
  • Really lagbox ?! What have you tried ? Writing something that cannot be parsed in the routes.php ? Did you change something in the Laravel conf ? – Dam Fa Jan 28 '15 at 10:58

1 Answers1

0

The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.

Check this for more details https://stackoverflow.com/a/1900224

Community
  • 1
  • 1
ARIF MAHMUD RANA
  • 5,026
  • 3
  • 31
  • 58
  • I'm not really ok with that... If I put those 4 lines at the very begining of my app : ` ini_set('display_errors', 1); ` `error_reporting(E_ALL); ` `ini_set("log_errors" , "1"); ` `ini_set("error_log" , dirname( __FILE__ )."/dev.log" ); ` I've got every errors (even the E_PARSE etc.) in my log file ! – Dam Fa Jan 28 '15 at 11:00