Skip to content
Snippets Groups Projects
Commit ff9aa911 authored by Alberto Paderno's avatar Alberto Paderno
Browse files

Issue #3462782: DrupalAPCCache::getPrefixSettingsForBin() does not correctly...

Issue #3462782: DrupalAPCCache::getPrefixSettingsForBin() does not correctly handle TRUE as prefix for cache bins
parent 15db772f
No related branches found
No related tags found
1 merge request!15Issue #3462782: DrupalAPCCache::getPrefixSettingsForBin() does not correctly handle TRUE as prefix for cache bins
Pipeline #229782 passed
......@@ -97,7 +97,7 @@ class DrupalAPCCache implements DrupalCacheInterface {
*
* @return string
* The prefix to use for the cache bin, or an empty string if no prefix has
* been set.
* been set or the prefix is not a string.
*/
protected static function getPrefixSettingForBin($bin) {
$prefixes = variable_get('apc_cache_prefix', '');
......@@ -108,47 +108,30 @@ protected static function getPrefixSettingForBin($bin) {
}
if (is_string($prefixes)) {
// $prefixes can be a string. In this case, the same prefix is used for
// all the cache bins.
// $prefixes can be a string used for all the cache bins.
return $prefixes;
}
if (is_array($prefixes)) {
if (isset($prefixes[$bin])) {
if (isset($prefixes[$bin]) && $prefixes[$bin] !== TRUE) {
if ($prefixes[$bin] === FALSE) {
// If $prefixes[$bin] is FALSE, no prefix is used for that cache bin,
// whatever the default prefix is.
// whichever value is used for $prefixes['default'].
return '';
}
else {
if (is_string($prefixes[$bin])) {
// If $prefixes[$bin] is set and not FALSE, that value is used for the
// cache bin.
return $prefixes[$bin];
}
}
else {
if (isset($prefixes['default'])) {
if ($prefixes['default'] === FALSE) {
// For $prefixes['default'], FALSE means no prefix is used.
return '';
}
elseif (is_string($prefixes['default'])) {
return $prefixes['default'];
}
else {
// Ignore any value which is neither a string nor a Boolean value.
return '';
}
}
else {
return '';
}
elseif (isset($prefixes['default']) && is_string($prefixes['default'])) {
return $prefixes['default'];
}
}
else {
// Ignore any value which is neither a string nor an array.
return '';
}
return '';
}
public function __construct($bin) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment