diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 6beda0fda1..7bd365ecb7 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.16 under development ------------------------ +- Bug #16974: Regular Expression Validator to include support for 'u' (UTF-8) modifier (Dzhuneyt) - Chg #16941: Set `yii\console\controllers\MigrateController::useTablePrefix` to true as default value (GHopperMSK) - Bug #16966: Fix ArrayExpression support in related tables (GHopperMSK) - Bug #16891: Fixed Pagination::totalCount initialized incorrectly (taobig) diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 5b0440b291..46987a359a 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -2318,7 +2318,7 @@ class BaseHtml $pattern = substr($pattern, 0, $pos + 1); } if (!empty($flag)) { - $pattern .= preg_replace('/[^igm]/', '', $flag); + $pattern .= preg_replace('/[^igmu]/', '', $flag); } return $pattern; diff --git a/tests/framework/helpers/HtmlTest.php b/tests/framework/helpers/HtmlTest.php index 8e1846e10a..950a8c348b 100644 --- a/tests/framework/helpers/HtmlTest.php +++ b/tests/framework/helpers/HtmlTest.php @@ -1800,6 +1800,11 @@ EOD; $expected = '/([a-z0-9-]+)/gim'; $actual = Html::escapeJsRegularExpression('/([a-z0-9-]+)/Ugimex'); $this->assertSame($expected, $actual); + + // Make sure that just allowed REGEX modifiers remain after the escaping + $expected = '/([a-z0-9-]+)/ugim'; + $actual = Html::escapeJsRegularExpression('/([a-z0-9-]+)/dugimex'); + $this->assertSame($expected, $actual); } public function testActiveDropDownList()