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!

hakre
  • 193,403
  • 52
  • 435
  • 836
Djordje Bakic
  • 187
  • 1
  • 7

3 Answers3

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);
Djordje Bakic
  • 187
  • 1
  • 7
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

Community
  • 1
  • 1
Herosony
  • 1
  • 2
-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.

hakre
  • 193,403
  • 52
  • 435
  • 836
Develop4Life
  • 7,581
  • 8
  • 58
  • 76