when copying a Laravel project from production down to my local machine today I got the following error while trying to access a specific page:
PHP Error: Maximum function nesting level of '100' reached, aborting
This was a first for me to see this, also of note I was not running this locally on wamp, I was simply serving the file with php artisan serve on windows using git bash. To fix the issue we took the following steps:
-locate the controller that powers the page generating the error (if you don’t know this off the top of your head, start back at your routes.php file). Look through the routes file unitl you find the correct controller.
-open up the controller and locate the function that is controlling the front end view (the page where your error is occurring). Next test to make sure you have the right function by adding dump and die to the top of your function:
dd($value);
*note you can also just use something like: dd('test');
-if you have the correct spot then the page will display your DD (dump and die) message. Once you confirm this then add the code below to fix the maximum function nesting error:
ini_set('xdebug.max_nesting_level', 200); //put this in here to fix local ini_set limit
That’s all there is too it. Also a side note its not a great practice to do this as a long term fix, there are probably larger issues at play that need to be addressed. But in my current case this worked perfectly and if anyone out there is running into the same issue hopefully this helps you solve it.