octicon-rss(16/)
You've already forked yii2
mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 02:13:17 +08:00
Fixes #16991: Removed usage of utf8_encode() from Request::resolvePathInfo()
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
committed by
Alexander Makarov
gitea-unlock(16/)
parent
4c88805f85
commit
a140b2b468
octicon-diff(16/tw-mr-1) 2 changed files with 22 additions and 1 deletions
@@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
|||||||
2.0.16 under development
|
2.0.16 under development
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
- Bug #16991: Removed usage of `utf8_encode()` from `Request::resolvePathInfo()` (GHopperMSK)
|
||||||
- Bug #16974: Regular Expression Validator to include support for 'u' (UTF-8) modifier (Dzhuneyt)
|
- 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)
|
||||||
|
|||||||
@@ -922,7 +922,7 @@ class Request extends \yii\base\Request
|
|||||||
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
||||||
)*$%xs', $pathInfo)
|
)*$%xs', $pathInfo)
|
||||||
) {
|
) {
|
||||||
$pathInfo = utf8_encode($pathInfo);
|
$pathInfo = $this->utf8Encode($pathInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scriptUrl = $this->getScriptUrl();
|
$scriptUrl = $this->getScriptUrl();
|
||||||
@@ -944,6 +944,26 @@ class Request extends \yii\base\Request
|
|||||||
return (string) $pathInfo;
|
return (string) $pathInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes an ISO-8859-1 string to UTF-8
|
||||||
|
* @param string $s
|
||||||
|
* @return string the UTF-8 translation of `s`.
|
||||||
|
* @see https://github.com/symfony/polyfill-php72/blob/master/Php72.php#L24
|
||||||
|
*/
|
||||||
|
private function utf8Encode($s)
|
||||||
|
{
|
||||||
|
$s .= $s;
|
||||||
|
$len = \strlen($s);
|
||||||
|
for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) {
|
||||||
|
switch (true) {
|
||||||
|
case $s[$i] < "\x80": $s[$j] = $s[$i]; break;
|
||||||
|
case $s[$i] < "\xC0": $s[$j] = "\xC2"; $s[++$j] = $s[$i]; break;
|
||||||
|
default: $s[$j] = "\xC3"; $s[++$j] = \chr(\ord($s[$i]) - 64); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return substr($s, 0, $j);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the currently requested absolute URL.
|
* Returns the currently requested absolute URL.
|
||||||
* This is a shortcut to the concatenation of [[hostInfo]] and [[url]].
|
* This is a shortcut to the concatenation of [[hostInfo]] and [[url]].
|
||||||
|
|||||||
Reference in New Issue
Block a user