Commit f9fba181 by Qiang Xue

Fixes #5806: Allow `Html::encode()` to be used when the application is not started

parent 74666f74
......@@ -25,6 +25,7 @@ Yii Framework 2 Change Log
- Enh #5613: Added `--overwrite` option to Gii console command to support overwriting all files (motin, qiangxue)
- Enh #5646: Call `yii\base\ErrorHandler::unregister()` instead of `restore_*_handlers` directly (aivus)
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)
- Enh #5806: Allow `Html::encode()` to be used when the application is not started (qiangxue)
- Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe)
- Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark)
- Chg #5508: Dropped the support for the `--append` option for the `fixture` command (qiangxue)
......
......@@ -93,7 +93,7 @@ class BaseHtml
*/
public static function encode($content, $doubleEncode = true)
{
return htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE, Yii::$app->charset, $doubleEncode);
return htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE, Yii::$app ? Yii::$app->charset : 'UTF-8', $doubleEncode);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment