1

I had this error twice and spent almost 30 minutes to debug it each time. I Hope it will help somebody because all I've found on the internet is solution for turning off xDebug.

PHP Fatal error: Maximum function nesting level of '100' reached, aborting!

3 Answers 3

1

This happened to me because I have accidentally injected two classes into each other.

class Foo(Bar $bar){}

class Bar(Foo $foo){}


$bar = new Bar(new Foo(new bar(new Foo(...))));

The reason why didn't saw that is because of Laravel IOC. So synax for instantiating a class would be something like:

$bar = new Bar(Foo $foo);
Sign up to request clarification or add additional context in comments.

Comments

0

Issue is caused by default xdebug.max_nesting_level which is 100.

By adding the line below to bootstrap/autoload.php in Laravel 5.1

ini_set('xdebug.max_nesting_level', 120);

.........

define('LARAVEL_START', microtime(true));

This answered helped me.

https://stackoverflow.com/a/30839127/3524046

Comments

-1

Here the issue in my case.

I have a service class which is librarie in codeigniter. Having a a function inside like this.

class PaymentService {

    private $CI;

    public function __construct() {

        $this->CI =& get_instance();

    }

    public function procss(){
        // lots of Ci referencing here ...
    }

my controller as followed:

$this->load->library('PaymentService');
$this->process_(); // see I got his wrong instead it should be like below

$this->Payment_service->process(); //the library class name

Then I was keeping getting the exceed error message. But I do disable XDebug but non helped. Any way please check you class name or your code for proper function calling.

1 Comment

This sounds rather like a "me too" comment than an actual answer to the question.

Your Answer

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.