I am running a website on Laravel and it was working fine on local system as well as on server previously.
Suddenly, this website has stopped and not working for few pages. On debugging or checking error log, I have found an error related to "Maximum function nesting level reached".
To find out for what thing, I am getting this error, i have debugged the code and found the below lines for which I am getting this error:
$customer = \App\Models\Customers\Customer::find(123);
echo $customer->toJson(); //Getting error for this line
Also tried to use toArray() instead of toJson(), but getting same error.
Now, I am not able to understand, why I am getting nesting level issue for just fetching only 1 record from database. Even customer table has few columns with not so much big data.
Can someone please help me? what is the reason behind the same?
-
1Possible duplicate of Solution for "Fatal error: Maximum function nesting level of '100' reached, aborting!" in PHPsh1hab– sh1hab2019年10月22日 06:20:46 +00:00Commented Oct 22, 2019 at 6:20
1 Answer 1
Maybe it is a Webserver configuration for xdebug you can increase it with
max_nesting_level
in your xdebug.ini or whereever you configurates your xdebug
-
Thanks for reply. When I increase the same then I am getting "This site can't be reached" error. And in error log there is no log for the same. and one more thing, I am just trying to fetch single record and there is no loop then why laravel is suddenly throwing this kind of error. And on my system, there is no xdebug installed. Please help me.Dhirender– Dhirender2019年10月23日 02:18:23 +00:00Commented Oct 23, 2019 at 2:18
-
Have you checked for back Relations or Relations to other Models which cause this error? Maybe this one : stackoverflow.com/questions/36579389/… can Help you, too :)bomel2k9– bomel2k92019年10月23日 08:53:21 +00:00Commented Oct 23, 2019 at 8:53