I have a Zend\Session Manager with a DbTableGateway to handle sessions. My code is in another SO answer. But whenever the session expires, I get an error Fatal error: Maximum function nesting level of '100' reached, aborting! in [path]\vendor\zendframework\zend-db\src\Sql\AbstractExpression.php on line 40
I found out how to change the xdebug nesting level to 200, but then I reached the 200 limit too.
So I have an infinite loop between DbTableGateway->read() and DbTableGateway->destroy(). I noticed the 2 lines referenced in the error each call the other method, but it's Zend code so I don't want to change it.
It only happens after the session expires, and not when I remove the row containing the session information from the database. When I looked at the table after this occurred, I noticed that the row is still present in the table except for the data column.
id name modified lifetime data
[random string] [session name] 1468587768 1440 -
So it looks like the read() method checks the table for a row containing the id and name, and finds this row, then calls destroy(), which calls read(). How can I fix this?
On a side note, refreshing the page solves the problem for the user, but I don't want to have code that throws an exception at the user and forces them to refresh the page.