diff --git a/libraries/src/Cache/Cache.php b/libraries/src/Cache/Cache.php index 9bc636965ad42..4d3693cd8b08c 100644 --- a/libraries/src/Cache/Cache.php +++ b/libraries/src/Cache/Cache.php @@ -595,7 +595,7 @@ public static function getWorkarounds($data, $options = array()) * @param string $data Cached data * @param array $options Array of options * - * @return array + * @return array Data to be cached * * @since 1.7.0 */ @@ -688,9 +688,13 @@ public static function setWorkarounds($data, $options = []) { $oldScriptStr = $options['headerbefore'][$now][strtolower($type)]; - if ($oldScriptStr != $currentScriptStr) + // Save only the appended declaration. + if (\is_array($oldScriptStr) && \is_array($currentScriptStr)) + { + $newvalue[strtolower($type)] = array_diff_key($currentScriptStr, $oldScriptStr); + } + else { - // Save only the appended declaration. $newvalue[strtolower($type)] = StringHelper::substr($currentScriptStr, StringHelper::strlen($oldScriptStr)); } }