Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Zend_Cache_Backend_TwoLevels::_getFastLifetime is incorrect. #423

Open
ragnese opened this issue Jun 5, 2024 · 0 comments

Comments

@ragnese
Copy link

ragnese commented Jun 5, 2024

Link:

private function _getFastLifetime($lifetime, $priority, $maxLifetime = null)

I discovered this issue in a project of ours that is using an ancient version of the original Zend_* stuff (before zf1-future existed), and it looks like it carried all the way over to today without being caught/fixed.

The problem is with how this method is called in the save method:

$fastLifetime = $this->_getFastLifetime($lifetime, $priority);
.

It's called with the default argument for $maxLifetime, which is null. The problem is that _getFastLifetime will always return null when $maxLifetime is null. This is because, if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) will always evaluate to true when $maxLifetime is null, and will therefore return $maxLifetime (null).

So the fast cache values are always being inserted with no lifetime/TTL and will never expire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant