Issue #2530936 by webflo: Ensure that the classloader prefix is really unique
parent
24219febf3
commit
1bb4e43db8
|
@ -170,7 +170,7 @@ final class Settings {
|
|||
*/
|
||||
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 @@ class SettingsTest extends UnitTestCase {
|
|||
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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue