1

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?

asked Oct 22, 2019 at 6:18
1

1 Answer 1

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

answered Oct 22, 2019 at 7:02
2
  • 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. Commented 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 :) Commented Oct 23, 2019 at 8:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.