Integrated icon indicating copy to clipboard operation
Integrated copied to clipboard

Maximum nesting level reached

Open ghost opened this issue 10 years ago • 6 comments

Hey I'm running a very simple test:

`/** @test */
public function it_reserves_an_event()
{
    $this->post('api/v1/reservations', [
        'first_name' => 'rodrigo',
        'last_name' => 'lessa',
        'phone_number' => '9543030759',
        'date' => '2015-06-18',
        'guests' => '5'
    ])
        ->seeJson()
        ->seeStatusCode(200)
        ->seeInDatabase('reservations', [
            'first_name' => 'rodrigo',
            'last_name' => 'lessa',
            'phone_number' => '9543030759',
            'date' => '2015-06-18',
            'guests' => '5'
        ]);
}`

and I get this error:

EPHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/rodrigo/WebApps/ThreeAccents/enjoy_louville/api/enjoy_louville/vendor/laravel/framework/src/Illuminate/Contracts/Cache/Factory.php on line 3

But i know its working because when I use postman that error is not thrown.

ghost avatar Jun 13 '15 18:06 ghost

Sounds like you're using Xdebug. You need to increase the max nesting level.

http://stackoverflow.com/questions/4293775/increasing-nesting-functions-calls-limit

bobbybouwmann avatar Jun 14 '15 18:06 bobbybouwmann

@bobbybouwmann It seems like that is just covering up the problem and not getting to the route of the problem

ghost avatar Jun 14 '15 20:06 ghost

No. It's just that default nesting is deep threw function calls and class calls. If there is a loop, rising it to 500 won't help you.

huglester avatar Jun 20 '15 12:06 huglester

I have put the limit to 200 in my php.ini and even added ini_set('xdebug.max_nesting_level', 200); I have received this same error for the past 8months using old and new versions of Test Dummy. Never been fixed for me. I cannot run a simple test using them. OH Well. Sorry I am no help. But this has been the most frustrating issue I've ever come across.

bmadigan avatar Jun 25 '15 11:06 bmadigan

And if you set it to 500? Or disable xdebug?

huglester avatar Jun 25 '15 12:06 huglester

I tried 500 and I got a different error. I can't remember exactly but it was something to do with hitting a STDError limit for the stack trace I believe. Anyways, I figure it was the way the ModelFactory itself was developed (on my end). If I had a USER and an TENANT models and TENANT had an owner_id which was trying to create a New USER. So I made the owner_id set to 1 and will change it on fly if needed. Seems to work.

bmadigan avatar Jun 25 '15 13:06 bmadigan