From ef349e03202628638247a71158ff04c49da2068a Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Fri, 10 May 2019 11:01:14 -0700 Subject: [PATCH] Fixed a bug that could occur when Craft generated URLs with multi-byte characters in the query string. --- CHANGELOG-v3.md | 1 + src/helpers/UrlHelper.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 801783ac1f2..a43e494c073 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -8,6 +8,7 @@ - Fixed a bug where Craft wasn’t removing newline characters when pasting text into some single-line Table column types. - Fixed a bug where project config syncing could have inconsistent results on load-balanced environments. ([](https://github.com/craftcms/cms/issues/4136)) - Fixed a bug where the Plugin Store was not able to load developer details. ([#4241](https://github.com/craftcms/cms/issues/4241)) +- Fixed a bug that could occur when Craft generated URLs with multi-byte characters in the query string. ## 3.1.26 - 2019-05-08 diff --git a/src/helpers/UrlHelper.php b/src/helpers/UrlHelper.php index 93189ec4837..c2c53ba11af 100644 --- a/src/helpers/UrlHelper.php +++ b/src/helpers/UrlHelper.php @@ -499,8 +499,8 @@ private static function _createUrl(string $path, $params, string $scheme = null, // Were there already any query string params in the path? if (($qpos = mb_strpos($path, '?')) !== false) { - $params = substr($path, $qpos + 1) . ($params ? '&' . $params : ''); - $path = substr($path, 0, $qpos); + $params = mb_substr($path, $qpos + 1) . ($params ? '&' . $params : ''); + $path = mb_substr($path, 0, $qpos); } $generalConfig = Craft::$app->getConfig()->getGeneral();