diff --git a/views/plugins/views_plugin_cache.inc b/views/plugins/views_plugin_cache.inc index 9899d48..2511955 100644 --- a/views/plugins/views_plugin_cache.inc +++ b/views/plugins/views_plugin_cache.inc @@ -208,12 +208,12 @@ class views_plugin_cache extends views_plugin { // If there are any differences between the old and the new javascript then // store them to be added later. - if ($diff = array_diff_assoc($js, $start)) { + if ($diff = array_diff_assoc_recursive($js, $start)) { $this->storage['js'] = $diff; } // Special case the settings key and get the difference of the data. - if ($settings_diff = array_diff_assoc($js['settings']['data'], $start['settings']['data'])) { + if ($settings_diff = array_diff_assoc_recursive($js['settings']['data'], $start['settings']['data'])) { $this->storage['js']['settings'] = $settings_diff; } } @@ -298,3 +298,23 @@ class views_plugin_cache extends views_plugin { } } + + function array_diff_assoc_recursive($array1, $array2) { + foreach ($array1 as $key => $value) { + if (is_array($value)) { + if (!isset($array2[$key])) { + $difference[$key] = $value; + } elseif (!is_array($array2[$key])) { + $difference[$key] = $value; + } else { + $new_diff = array_diff_assoc_recursive($value, $array2[$key]); + if ($new_diff != FALSE) { + $difference[$key] = $new_diff; + } + } + } elseif (!isset($array2[$key]) || $array2[$key] != $value) { + $difference[$key] = $value; + } + } + return !isset($difference) ? 0 : $difference; + }