Fixes #16974: Regular Expression Validator to include support for 'u' (UTF-8) modifier

This commit is contained in:
Dzhuneyt
2019-01-03 22:12:42 +02:00
committed by Alexander Makarov
parent e0e73cf5b5
commit a790685e66
3 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.16 under development 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) - Chg #16941: Set `yii\console\controllers\MigrateController::useTablePrefix` to true as default value (GHopperMSK)
- Bug #16966: Fix ArrayExpression support in related tables (GHopperMSK) - Bug #16966: Fix ArrayExpression support in related tables (GHopperMSK)
- Bug #16891: Fixed Pagination::totalCount initialized incorrectly (taobig) - Bug #16891: Fixed Pagination::totalCount initialized incorrectly (taobig)

View File

@ -2318,7 +2318,7 @@ class BaseHtml
$pattern = substr($pattern, 0, $pos + 1); $pattern = substr($pattern, 0, $pos + 1);
} }
if (!empty($flag)) { if (!empty($flag)) {
$pattern .= preg_replace('/[^igm]/', '', $flag); $pattern .= preg_replace('/[^igmu]/', '', $flag);
} }
return $pattern; return $pattern;

View File

@ -1800,6 +1800,11 @@ EOD;
$expected = '/([a-z0-9-]+)/gim'; $expected = '/([a-z0-9-]+)/gim';
$actual = Html::escapeJsRegularExpression('/([a-z0-9-]+)/Ugimex'); $actual = Html::escapeJsRegularExpression('/([a-z0-9-]+)/Ugimex');
$this->assertSame($expected, $actual); $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() public function testActiveDropDownList()