Skip to content
This repository was archived by the owner on May 16, 2018. It is now read-only.
This repository was archived by the owner on May 16, 2018. It is now read-only.

Zend_Cache_Backend_TwoLevels fast backend lifetime always set to infinite on cache save #503

Open

Description

@mcnathanator

Version: 1.12.10dev
Class: Zend_Cache_Backend_TwoLevels
Method: _getFastLifetime()
Line: 504

In Zend_Cache_Backend_TwoLevels on calling save() _getFastLifetime() is called without the 3th parameter $maxLifetime. $maxLifetime will default to null. Resulting in infinite lifetime no matter what $lifetime or $priority is given.
The reason; at line 504 "$maxLifetime >= 0" will be "null >= 0" and that will return true (in my php version atleast) therefor "return $maxLifetime;" will return the lifetime of null.

Isolated the code looks like this:

 $lifetime = 3600;
 $priority = 8;
 $fastLifetime = $this->_getFastLifetime($lifetime, $priority);
 echo $fastLifetime;

What I would expect is 1200. What I get is null.

Activity

  1. MarcoMiltenburg commented on Aug 1, 2016

    @MarcoMiltenburg

    Confirmed, I just found this bug as well. The fix is easy though by changing >= to > as $maxLifetime only makes sense when it's greater than zero. Just opened a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions