Skip to content

Commit f7a5452

Browse files
committed
MAGETWO-66049: Remove usages of unserialize in Magento/Framework/Url
1 parent aa27856 commit f7a5452

File tree

1 file changed

+8
-10
lines changed
  • lib/internal/Magento/Framework

1 file changed

+8
-10
lines changed

lib/internal/Magento/Framework/Url.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -835,14 +835,12 @@ public function getUrl($routePath = null, $routeParams = null)
835835
$isArray = is_array($routeParams);
836836

837837
if ($isArray) {
838-
array_walk_recursive(
839-
$routeParams,
840-
function ($item) use (&$isCached) {
841-
if (is_object($item)) {
842-
$isCached = false;
843-
}
838+
foreach ($routeParams as $item) {
839+
if (is_object($item)) {
840+
$isCached = false;
841+
break;
844842
}
845-
);
843+
}
846844
}
847845

848846
if(!$isCached) {
@@ -851,12 +849,12 @@ function ($item) use (&$isCached) {
851849
);
852850
}
853851

854-
$cashedParams = $routeParams;
852+
$cachedParams = $routeParams;
855853
if ($isArray) {
856-
ksort($cashedParams);
854+
ksort($cachedParams);
857855
}
858856

859-
$cacheKey = md5($routePath . serialize($cashedParams));
857+
$cacheKey = md5($routePath . json_encode($cachedParams));
860858
if (!isset($this->cacheUrl[$cacheKey])) {
861859
$this->cacheUrl[$cacheKey] = $this->getUrlModifier()->execute(
862860
$this->createUrl($routePath, $routeParams)

0 commit comments

Comments
 (0)