mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
ErrorHandler - hardcoded UTF-8 in mb_* functions
As `Yii::$app` may be not initialized on the moment of error, decided to hardcode UTF-8. PR #10169
This commit is contained in:
@ -162,7 +162,7 @@ class ErrorHandler extends \yii\base\ErrorHandler
|
|||||||
*/
|
*/
|
||||||
public function htmlEncode($text)
|
public function htmlEncode($text)
|
||||||
{
|
{
|
||||||
return htmlspecialchars($text, ENT_QUOTES, Yii::$app->charset);
|
return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -391,8 +391,8 @@ class ErrorHandler extends \yii\base\ErrorHandler
|
|||||||
$args[$key] = '<span class="keyword">' . ($value ? 'true' : 'false') . '</span>';
|
$args[$key] = '<span class="keyword">' . ($value ? 'true' : 'false') . '</span>';
|
||||||
} elseif (is_string($value)) {
|
} elseif (is_string($value)) {
|
||||||
$fullValue = $this->htmlEncode($value);
|
$fullValue = $this->htmlEncode($value);
|
||||||
if (mb_strlen($value, Yii::$app->charset) > 32) {
|
if (mb_strlen($value, 'UTF-8') > 32) {
|
||||||
$displayValue = $this->htmlEncode(mb_substr($value, 0, 32, Yii::$app->charset)) . '...';
|
$displayValue = $this->htmlEncode(mb_substr($value, 0, 32, 'UTF-8')) . '...';
|
||||||
$args[$key] = "<span class=\"string\" title=\"$fullValue\">'$displayValue'</span>";
|
$args[$key] = "<span class=\"string\" title=\"$fullValue\">'$displayValue'</span>";
|
||||||
} else {
|
} else {
|
||||||
$args[$key] = "<span class=\"string\">'$fullValue'</span>";
|
$args[$key] = "<span class=\"string\">'$fullValue'</span>";
|
||||||
|
Reference in New Issue
Block a user