-
Bug
-
Resolution: Fixed
-
Minor
-
2.7.9
-
MOODLE_27_STABLE
-
MOODLE_28_STABLE, MOODLE_29_STABLE
-
wip-
MDL-50932-master -
The code: \cachestore_file->get
if ($this->prescan && array_key_exists($key, $this->keys)) {
|
if (!$ttl || $this->keys[$filename] >= $maxtime && file_exists($file)) {
|
$readfile = true;
|
} else {
|
$this->delete($key);
|
}
|
And in particular, this line:
if (!$ttl || $this->keys[$filename] >= $maxtime && file_exists($file)) {
|
Parentheses are needed around the TTL and max time checks, otherwise file_exists is completely ignored. Testing it in PHP interpreter:
// Without parentheses.
|
php > var_dump((true || false && false));
|
bool(true)
|
// With parentheses.
|
php > var_dump(((true || false) && false));
|
bool(false)
|