Project

General

Profile

Actions

Bug #54071

closed

cache.lifetime value returned as a string - error in Redis cache backend

Added by Jan Slusarczyk over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-11-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I was experimenting with Redis as a cache backend for typo3 4.7. Everything seemed to be working ok until I enabled cache_hash using the following:


$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['backend'] = 't3lib_cache_backend_RedisBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['options'] = array(
'hostname' => '127.0.0.1',
'database' => 13,
);

Typo3 started to generate the following exception:

Oops, an error occurred!
The specified lifetime is of type "string" but a string or NULL is expected.

I've checked the source code of class.t3lib_cache_backend_redisbackend.php and lifetime is being checked for integer rather than a string:


[line 347] $lifetimeIsNull = is_null($lifetime);
[line 348] $lifetimeIsInteger = is_integer($lifetime);
[line 349]
[line 350] if (!$lifetimeIsNull && !$lifetimeIsInteger) {

So the value was failing the integer check. I've nailed the problem to a specific TyposScript object:


lib.forumNews = TEXT
lib.forumNews {
cache.key = bb7_forumnews
cache.lifetime = 60
cObject = COA
cObject {
10 = TEXT
10.value = <h5>...
20 = USER
20.userFunc = user_feeds->user_linki
30 = TEXT
30.value = <div class...
}
}

cache.lifetime is indeed being passed to redis cache script as a string of value "60". I've tried intval($lifetime) and it started to work smoothly.

I'm not sure what is the real error here - it's eithertyposcript bug and cache.lifetime should be returned as integer (makes sense) or redis cache backend should use intval when using the lifetime value.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #54072: Incorrect error message in Redis cache backendClosed2013-11-29

Actions
Actions #1

Updated by Philipp Gampe over 10 years ago

  • Status changed from New to Accepted

TypoScript always gets parsed into strings. The caller in the cache function should make sure that the lifetime is passed as integer to the cache backend.

Can you push a patch to gerrit for 6.0-6.2 (no 4.7 any more).
http://wiki.typo3.org/CWT

Actions #2

Updated by Mathias Schreiber over 9 years ago

  • Status changed from Accepted to Closed

fixed on master

Actions

Also available in: Atom PDF