Nesting Level Too Deep


I’ve just upgraded from 1.4 to 1.5 and I’m seeing the following error everywhere…

Fatal error: Nesting level too deep - recursive dependency? in C:\inetpub\wwwroot\Piwik\core\ErrorHandler.php on line 36

It’s being displayed on the dashboard in almost every module and all over the place (instead of the data it should be showing) throughout the rest of the application. What the hell is going on?

(Matthieu Aubry) #2

Is there any other error displayed? or maybe, some errors in your webserver error log?


Is there any other error displayed? or maybe, some errors in your webserver error log?[/quote]

No and it appears to only be happening when viewing my stats site from the server itself. If accessed from another machine on the network all is displayed correctly.

(Matthieu Aubry) #4

That’s really strange. If you find more info about this let us know, it would be interesting to know what’s the bug


I’m having the same problem (using Centos 5.6 with PHP 5.1.6), except it occurs from wherever I access the server and won’t let me log in (unless I modify the code to skip verifyNonce.)

It seems tied to the new core/Session.php code that uses the database for sessions.

If I comment out the block starting with:

if(in_array($currentSaveHandler, array(‘user’, ‘mm’, ‘files’)))

…it works again (using “files” as the session handler.)

The session table exists and is in proper format, but nothing gets written to it. Zend_Session::start() doesn’t throw an exception, either. I was going to upgrade to PHP 5.3 but I might look at this a little more out of curiosity.


OK, I’ve got it working (as far as my server running PHP 5.1.6, haven’t tested elsewhere.)

In core/Session.php, I added the following:

register_shutdown_function(array( "Zend_Session", "writeClose" ), true);

…after the line:


I determined (under XDebug) that Zend_Session::writeClose() was being called from the destructor Zend_Session_SaveHandler_DbTable->__destruct(), and thought maybe the database handle wasn’t available at that point. After I made this change to the code I can log in normally, don’t see errors anywhere, and can observe the session records being added properly to the table.


I’m trying to do the right thing, but Trac/Akismet is annoyingly rejecting my comments as spam. I added this to ErrorHandler - Nesting level too deep - recursive dependency · Issue #2499 · matomo-org/matomo · GitHub, but I think it might address Session SaveHandler DbTable - Fatal error: Exception thrown without a stack frame in Unknown on line 0 · Issue #2491 · matomo-org/matomo · GitHub as well.

(Matthieu Aubry) #8

ferment thanks for your patch and explanations. I have asked other users with this bug to try out your patch.

(vipsoft) #9

Weird. 5.1.6 is one of the versions I tested. If we can get some more confirmations, we’ll get it into the next point release.

(vipsoft) #10

Thanks Ferment. I’ve commited your fix to trunk.

(vipsoft) #11

p.s. the nesting problem is now fixed in trunk. The ErrorHandler no longer uses var_export() to dump the args. (Note: I opted to not use print_r() as a replacement because the output was just too ugly to reformat/clean-up.)


same problem here…will try the fix. no piwik update without annoying timeconsuming bugs i guess -.-


Same problem here. PHP is 5.3.6. Tried ferment´s solution, but with no effect :frowning:
Only the widget with the SEO-ranks is displayed correctly. Hope Anthon´s fix will work for me.

(Scott Hack) #14

I’ve got the same issue using php 5.2.17

(Scott Hack) #15

I tried adding the line above and I’m still getting the error.