[BUGFIX][Cache][PDO] Duplicate cache entry possible 44/9144/6
authorLeon Dietsch <leon.dietsch@googlemail.com>
Tue, 27 Nov 2012 01:12:52 +0000 (02:12 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 7 Feb 2013 21:20:13 +0000 (22:20 +0100)
commit9e5153be55bd4869d3a1b456f9a23d59cde3f92d
treea2e4b2bf2bbd632c162fbd199508a4084418d567
parentc02d2d3bd90703694f1280a34631fecf32f62b88
[BUGFIX][Cache][PDO] Duplicate cache entry possible

An identifier must be unique in the database. If some entry is set(),
the PdoBackend removes any entry with a given identifier if the cache
entry exists already. The remove() call is encapsulated with has(),
but has() returns FALSE if a cache entry is expired, so entries with
expired lifetime are not removed properly.
This leads to a \PDOException because of duplicate identifier.

The patch removes the check to has(), so set() will also remove
expired cache entries with this identifier before creating a new one.

Change-Id: Ife4e35223394805fc6d9e0b820a5d42789133f7b
Fixes: #34129
Releases: 6.1, 6.0, 4.7, 4.6, 4.5
Reviewed-on: https://review.typo3.org/9144
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Cache/Backend/PdoBackend.php
typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php