See reportings in http://forum.piwik.org/read.php?5,77659 and http://forum.piwik.org/read.php?5,78118.
Reason for the error seems to be the use of var_export in connection with debug_backtrace, see http://bugs.php.net/bug.php?id=30471 (bugs.php.net down atm)
PHP 5.2
Other configurations affected, see below
Attachment: var_dump($bt) from core/ErrorHandler.php
dump.html
Attachment: Thanks for the dump, ferment. The "Nesting level too deep"-Problem has nothing to do with other classes of piwik. It is a problem when one of the other classes throw an error, and contain a reference to itself (e.g. method chaining, &$object definition, etc.). This is often used within frameworks. Since varexport is not able to limit the depth of nesting, I propose the following patch for the ErrorHandler.
[Refs#2499.patch](http://issues.piwik.org/attachments/2499/Refs_#2499.patch)
Attachment: Applying this Patch doesn't work for me komplete, now i got many errors, see attachment.
errors.html
Replying to peterb:
I'm using PHP 5.1.6 and just started getting this problem with my upgrade to Piwik 1.5 from 1.4.
Using XDebug, I tracked it down to a problem with Zend_Session. It's failing to write sessions to the database table, possibly because the database handle is no longer available when Zend_Session::writeClose() is called in the destructor of Zend_Session_SaveHandler_DbTable (I'm not 100% certain.)
At any rate, I changed the file core/Session.php, adding:
register_shutdown_function(array( "Zend_Session", "writeClose" ), true);
...after the line:
Zend_Session::start();
...and it now seems to work for me (no more nesting level errors, and I can also log into Piwik again.) But I haven't tested it on any other version of PHP.
ferment, could you please tell us, what a var_dump($bt) injected into the file core/ErrorHandler.php (directly before, after or instead of the line "//array_shift($bt);" echos? I think we would be a step further then, because there is somehow a recursion in that context, i suppose.
On my side, the adding of register_shutdown_function doesn't work.
I have Piwik running with cronjobs and the error is only coming in the cronjob via email. Login into the Piwik web webinterface works without problems.
PHP Fatal error: Nesting level too deep - recursive dependency? in /srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ErrorHandler.php on line 36
PHP Fatal error: Nesting level too deep - recursive dependency? in /srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ErrorHandler.php on line 36
PHP Fatal error: Nesting level too deep - recursive dependency? in /srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ErrorHandler.php on line 36
PHP Fatal error: Nesting level too deep - recursive dependency? in /srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ErrorHandler.php on line 36
Removing the line 36 brings out the following error:
Notice: Undefined offset: 7 in /srv/www/vhosts/pantanet.de/subdomains/piwik/httpdocs/core/ArchiveProcessing/Day.php on line 671
<a href='/0'>#0</a> Piwik_ErrorHandler() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ArchiveProcessing/Day.php:671]
<a href='/1'>#1</a> Piwik_ArchiveProcessing_Day->updateInterestStats() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/plugins/CustomVariables/CustomVariables.php:165]
<a href='/2'>#2</a> Piwik_CustomVariables->archiveDayAggregate() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/plugins/CustomVariables/CustomVariables.php:138]
<a href='/3'>#3</a> Piwik_CustomVariables->archiveDay() called at [:]
<a href='/4'>#4</a> call_user_func_array() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/libs/Event/Dispatcher.php:284]
<a href='/5'>#5</a> Event_Dispatcher->postNotification() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/PluginsManager.php:609]
<a href='/6'>#6</a> Piwik_PostEvent() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ArchiveProcessing/Day.php:42]
<a href='/7'>#7</a> Piwik_ArchiveProcessing_Day->compute() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/ArchiveProcessing.php:429]
<a href='/8'>#8</a> Piwik_ArchiveProcessing->launchArchiving() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/Archive/Single.php:217]
<a href='/9'>#9</a> Piwik_Archive_Single->prepareArchive() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/Archive/Single.php:246]
<a href='/10'>#10</a> Piwik_Archive_Single->get() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/Archive/Single.php:424]
<a href='/11'>#11</a> Piwik_Archive_Single->getNumeric() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/Archive/Array.php:89]
<a href='/12'>#12</a> Piwik_Archive_Array->getNumeric() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/plugins/VisitsSummary/API.php:110]
<a href='/13'>#13</a> Piwik_VisitsSummary_API->getNumeric() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/plugins/VisitsSummary/API.php:116]
<a href='/14'>#14</a> Piwik_VisitsSummary_API->getVisits() called at [:]
<a href='/15'>#15</a> call_user_func_array() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/API/Proxy.php:179]
<a href='/16'>#16</a> Piwik_API_Proxy->call() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/API/Request.php:121]
<a href='/17'>#17</a> Piwik_API_Request->process() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/plugins/API/Controller.php:27]
<a href='/18'>#18</a> Piwik_API_Controller->index() called at [:]
<a href='/19'>#19</a> call_user_func_array() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/core/FrontController.php:127]
<a href='/20'>#20</a> Piwik_FrontController->dispatch() called at [/srv/www/vhosts/xxx.de/subdomains/piwik/httpdocs/index.php:53]
Replying to peterb:
ferment, could you please tell us, what a var_dump($bt) injected into the file core/ErrorHandler.php (directly before, after or instead of the line "//array_shift($bt);" echos? I think we would be a step further then, because there is somehow a recursion in that context, i suppose.
Sure. I've attached a copy of the dump to the thread.
Replying to peterb:
I think what might be happening is that var_export() is getting stuck on a circular reference in one of the $bt args. I ran across a forum discussion about this while searching:
http://forum.kohanaframework.org/discussion/1631/var_dump-print_r-var_export/p1
Anthon, do we need to store executable PHP code in the logger (to reuse it somewhere for example), or would this patch make sense?
@GoSnA: yes, that's correct. As I stated, this is not related to the error that triggers the ErrorHandler. Now the Errors are displayed / handled correctly and we can track down the real root of the error(s).
Thanks Peter. I'll have to look at the preg_replace, but this evidently works better than var_export.
We should fix the Notices being emitted too.
GoSnA, this is strange - please make sure, all piwik files have been correctly updated to the newest version.
Could this somehow be linked to #2491 ?
I strongly suggest to release 1.6 ASAP or at least 1.5.1 with this patch applied... My piwik was also broken and I fixed it by uploading the latest errorhandler.php.