diff --git a/ChangeLog b/ChangeLog index 4ebb4b51a72b6452af4aeee02df1cf274a5e38bf..87251a62fe6526344aa788b5618e5749a9454a33 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-11 Christian Kuhn <lolli@schwarzbu.ch> + + * Fixed bug #15417: [Caching framework] DbBackend has() returns false for entries with unlimited lifetime + 2010-08-11 Steffen Kamper <steffen@typo3.org> * Fixed bug #15338: sys_action: Link to edit the sql query action is missing for newly created actions (Thanks to Stefan Galinski) diff --git a/t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php b/t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php index fec585932ddd06131241941b5a9f9245f6421c18..187aa64331aabac4da56ceca10bb6de5e1062c95 100644 --- a/t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php +++ b/t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php @@ -203,7 +203,7 @@ class t3lib_cache_backend_DbBackend extends t3lib_cache_backend_AbstractBackend '*', $this->cacheTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . - ' AND crdate + lifetime >= ' . $GLOBALS['EXEC_TIME'] + ' AND (crdate + lifetime >= ' . $GLOBALS['EXEC_TIME'] . ' OR lifetime = 0)' ); if ($cacheEntries >= 1) { $hasEntry = TRUE; diff --git a/tests/t3lib/cache/backend/t3lib_cache_backend_dbbackendTest.php b/tests/t3lib/cache/backend/t3lib_cache_backend_dbbackendTest.php index 0f55fae2a88d31f6f04216e1b8184e013b2aaa05..85b02f729db4508b04b8fafd6baffb20c5f32bcb 100644 --- a/tests/t3lib/cache/backend/t3lib_cache_backend_dbbackendTest.php +++ b/tests/t3lib/cache/backend/t3lib_cache_backend_dbbackendTest.php @@ -599,6 +599,24 @@ class t3lib_cache_backend_DbBackendTest extends tx_phpunit_testcase { $this->assertFalse($this->backend->has($expiredEntryIdentifier), 'has() did not return FALSE.'); } + /** + * @test + * @author Christian Kuhn <lolli@schwarzbu.ch> + */ + public function hasReturnsTrueForEntryWithUnlimitedLifetime() { + $this->setUpBackend(); + $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array(), array(), '', FALSE); + $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('UnitTestCache')); + + $entryIdentifier = 'BackendDbTest'; + + $this->backend->setCache($mockCache); + $this->backend->set($entryIdentifier, 'data', array(), 0); + + $GLOBALS['EXEC_TIME'] += 1; + $this->assertTrue($this->backend->has($entryIdentifier)); + } + /** * @test * @author Ingo Renner <ingo@typo3.org>