Issue #2352207 by martin107, Berdir: Database cache backend does not treat cid as case sensitive

8.0.x
Alex Pott 2014-11-25 21:41:36 +00:00
parent 8415e43451
commit 40a7440d6b
3 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,8 @@ namespace Drupal\Core\Cache;
* Drupal\Core\Cache\DatabaseBackend provides the default implementation, which
* can be consulted as an example.
*
* The cache indentifiers are case sensitive.
*
* @ingroup cache
*/
interface CacheBackendInterface {

View File

@ -564,6 +564,7 @@ class DatabaseBackend implements CacheBackendInterface {
'length' => 255,
'not null' => TRUE,
'default' => '',
'binary' => TRUE,
),
'data' => array(
'description' => 'A collection of data to cache.',

View File

@ -213,6 +213,11 @@ abstract class GenericCacheBackendUnitTestBase extends DrupalUnitTestBase {
$backend->set($cid, 'test');
$this->assertEqual('test', $backend->get($cid)->data);
// Check that the cache key is case sensitive.
$backend->set('TEST8', 'value');
$this->assertEqual('value', $backend->get('TEST8')->data);
$this->assertFalse($backend->get('test8'));
// Calling ::set() with invalid cache tags.
try {
$backend->set('exception_test', 'value', Cache::PERMANENT, ['node' => [3, 5, 7]]);