Laravel 4 with MySql db. For some reason, I cannot catch DB exceptions (Illuminate\\Database\\QueryException) inside a seed or migration class: the code nev
Thanks to php exceeds execution time on throwing an exception in recursion I finally understood the problem.
Apparently it's related to XDebug, and it occurs only on PHP on Mac OS X (I tried several PHPs on Windows, but never ran into this problem), and only when running a migration or seed by CLI (e.g. php artisan db:seed --class=className).
It's related to these XDebug settings:
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
I don't exactly know why, but this caused QueryException to never be catched, and PHP showed me the entire exception stack.
If I comment these options, or set them to a more appropriate value (e. g. 10) or if I disable XDebug (not a good solution), everything runs ok, and inside migrations/seeds I can catch QueryExceptions.