0

I'm not sure what happened, but it appears that during a recent update of some library, I can no longer upload files without getting the following Laravel error:

[2014-11-15 21:27:25] local.ERROR: 500 - Maximum function nesting level of '100' reached, aborting! @ /uploads/0/1
exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum function nesting level of '100' reached, aborting!' in /home/vagrant/Projects/test.dev/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:480
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []

The stack trace provides no useful information.

Interrupting the script even at the start of the method for that route does nothing, so it isn't something in my own code.

Anyone seen this bug in the latest Laravel 4.2?

eComEvo
  • 11,669
  • 26
  • 89
  • 145

3 Answers3

1

Actually, this error message appears because of XDebug extension.You may increase the limit in your php.ini file:

xdebug.max_nesting_level = 200

Also, it could be for a recursive function call so try to find out if you have something in your code and optimize it. Too much recursion causes the stackoverflow (stack memory gets overflowed).

The Alpha
  • 143,660
  • 29
  • 287
  • 307
  • I can't think of a reason it needs to recurse that much. This is a simple route. If it is going that deep, there is likely a problem somewhere. – eComEvo Nov 15 '14 at 21:41
  • Not sure, didn't see any code that you or the extension is using. – The Alpha Nov 15 '14 at 21:42
  • 1
    Just using FileAPI to do a simple upload via AJAX. I haven't changed any of my own code so I don't know what to show you. The line 480 in Container.php is for the function `missingLeadingSlash` called from `getConcrete` called from `make`. I don't see anywhere in there that could lead to recursion, so I'm a bit confused. – eComEvo Nov 15 '14 at 21:46
  • Did you try to increase the value? So much of nested function calls (calling one function from within another) may cause this error to rise, so if you increase the value in `php.ini` file you may get a result. – The Alpha Nov 15 '14 at 21:51
  • Bumped it all the way up to 1,000 and same issue: `Maximum function nesting level of '1000' reached, aborting` – eComEvo Nov 15 '14 at 21:54
  • Not sure tho, [check this answer](http://stackoverflow.com/questions/8656089/solution-for-fatal-error-maximum-function-nesting-level-of-100-reached-abor). – The Alpha Nov 15 '14 at 21:58
  • No luck there. What would be my best option for tracing this all the way back through the code, even the closures that are apparently involved in this? I need something more comprehensive that this paltry stack trace PHP is splitting out by default. Must see what was involved in `#1 {main} [] []`. – eComEvo Nov 15 '14 at 22:09
  • No good. I did manage to track it down to `return $this->app->handle($request, $type, $catch);` in `StackedHttpKernel.php` but haven't a clue what could be causing that to recurse. – eComEvo Nov 15 '14 at 22:43
  • Actually, `StackedHttpKernel.php` is a class of `Stack` component and it's a very low level component which handles stacked middlewares for the application. Each middleware class's `handle` method calls the next one so there is a lots of nested calls are being invoked. Probably the issue is with too mnay nesting of function calls. But still it's not logical to me. – The Alpha Nov 16 '14 at 08:43
  • 1
    Thanks for your help with cracking this one! Turned out to be some sort of recursive nesting issue that I still don't understand, but I posted the actual solution that fixed it. – eComEvo Nov 19 '14 at 22:49
0

This is not a bug. PHP has limit recursive functions. This limit default 100.

If you want to increase this limit use XDebug.

Adil
  • 1,008
  • 11
  • 21
0

This resulted from a method that I pulled up into a parent controller and forgot about it. Apparently Laravel didn't like the route being accessed in that manner. Pulling it back down into the child controller allowed it to work correctly.

eComEvo
  • 11,669
  • 26
  • 89
  • 145