From b398d04d96c7ac193d1b3ba2f2b60329c898ba4b Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 20 Jun 2019 00:45:59 +0300 Subject: [PATCH] Fixed a bug in `Route::withParam()` method --- CHANGELOG.md | 1 + system/src/Grav/Framework/Route/Route.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15a9415ac..f27512001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ 1. [](#bugfix) * Fixed error in `ImageMedium::url()` if the image cache folder does not exist * Fixed empty form flash name after update + * Fixed a bug in `Route::withParam()` method # v1.6.10 ## 06/14/2019 diff --git a/system/src/Grav/Framework/Route/Route.php b/system/src/Grav/Framework/Route/Route.php index a75234077..49ff78920 100644 --- a/system/src/Grav/Framework/Route/Route.php +++ b/system/src/Grav/Framework/Route/Route.php @@ -313,9 +313,9 @@ class Route */ protected function withParam($type, $param, $value) { - $oldValue = $this->{$type}[$param] ?? null; + $typeValue = $this->{$type}[$param] ?? null; - if ($oldValue === $value) { + if ($typeValue === $value) { return $this; } @@ -323,7 +323,8 @@ class Route if ($value === null) { unset($new->{$type}[$param]); } else { - $new->{$type}[$param] = $value; + $typeValue[$param] = $value; + $new->{$type} = $typeValue; } return $new;