Commit 1bb4e43d authored by alexpott's avatar alexpott

Issue #2530936 by webflo: Ensure that the classloader prefix is really unique

parent 24219feb
......@@ -170,7 +170,7 @@ public static function getHashSalt() {
*/
public static function getApcuPrefix($identifier, $root, $site_path = '') {
if (static::get('apcu_ensure_unique_prefix', TRUE)) {
return 'drupal.' . $identifier . '.' . hash_hmac('sha256', $identifier, static::get('hash_salt', $root . '/' . $site_path));
return 'drupal.' . $identifier . '.' . hash_hmac('sha256', $identifier, static::get('hash_salt') . '.' . $root . '/' . $site_path);
}
return 'drupal.' . $identifier . '.' . Crypt::hashBase64($root . '/' . $site_path);
}
......
......@@ -118,4 +118,17 @@ public function testSerialize() {
serialize(new Settings([]));
}
/**
* Tests Settings::getApcuPrefix().
*
* @covers ::getApcuPrefix
*/
public function testGetApcuPrefix() {
$settings = new Settings(array('hash_salt' => 123));
$this->assertNotEquals($settings::getApcuPrefix('cache_test', '/test/a'), $settings::getApcuPrefix('cache_test', '/test/b'));
$settings = new Settings(array('hash_salt' => 123, 'apcu_ensure_unique_prefix' => FALSE));
$this->assertNotEquals($settings::getApcuPrefix('cache_test', '/test/a'), $settings::getApcuPrefix('cache_test', '/test/b'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment