|
|
@@ -115,11 +115,8 @@ class UrlCacheManager {
|
|
|
if (is_array($keyUrl)) {
|
|
|
$keyUrl += static::$extras;
|
|
|
// prevent different hashs on different orders
|
|
|
- ksort($keyUrl, SORT_STRING);
|
|
|
// prevent different hashs on different types (int/string/bool)
|
|
|
- foreach ($keyUrl as $key => $val) {
|
|
|
- $keyUrl[$key] = (string) $val;
|
|
|
- }
|
|
|
+ $keyUrl = static::prepareForSerialize($keyUrl);
|
|
|
}
|
|
|
static::$key = md5(serialize($keyUrl) . $full);
|
|
|
|
|
|
@@ -152,5 +149,25 @@ class UrlCacheManager {
|
|
|
static::$cache[static::$key] = $data;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public static function prepareForSerialize($array) {
|
|
|
+ if (!is_array($array)) {
|
|
|
+ return $array;
|
|
|
+ }
|
|
|
+ // prevent different hashs on different orders
|
|
|
+ ksort($array, SORT_STRING);
|
|
|
+ // prevent different hashs on different types (int/string/bool)
|
|
|
+ foreach ($array as $key => $val) {
|
|
|
+ if (is_array($val)) {
|
|
|
+ $array[$key] = static::prepareForSerialize($val);
|
|
|
+ } else {
|
|
|
+ $array[$key] = (string) $val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $array;
|
|
|
+ }
|
|
|
|
|
|
}
|