From 1f0e24c528f77a5c3d5af1efbc12ebb12387e842 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 21 Apr 2016 12:54:59 +0200 Subject: [PATCH] allow resetting autodetected properties in yii\web\Request fixes #11336 --- framework/CHANGELOG.md | 1 + framework/web/Request.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 9214064..875e815 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -195,6 +195,7 @@ Yii Framework 2 Change Log - Enh #10545: `yii\web\XMLResponseFormatter` changed to format models in a proper way (andrewnester) - Enh #10783: Added migration and unit-tests for `yii\i18n\DbMessageSource` (silverfire) - Enh #10797: Cleaned up requirements checker CSS (muhammadcahya) +- Enh #11336: Allow resettting `$hostInfo`, `$scriptUrl`, and `$pathInfo` in `yii\web\Request` to `null`, to make Yii determine the value again (cebe) - Enh: Added last resort measure for `FileHelper::removeDirectory()` fail to unlink symlinks under Windows (samdark) - Enh: `AttributeBehavior::getValue()` now respects the callable in array format (silverfire) - Chg #6419: Added `yii\web\ErrorHandler::displayVars` make list of displayed vars customizable. `$_ENV` and `$_SERVER` are not displayed by default anymore (silverfire) diff --git a/framework/web/Request.php b/framework/web/Request.php index e6387e3..d95ccc5 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -557,7 +557,7 @@ class Request extends \yii\base\Request */ public function setHostInfo($value) { - $this->_hostInfo = rtrim($value, '/'); + $this->_hostInfo = $value === null ? null : rtrim($value, '/'); } private $_baseUrl; @@ -628,7 +628,7 @@ class Request extends \yii\base\Request */ public function setScriptUrl($value) { - $this->_scriptUrl = '/' . trim($value, '/'); + $this->_scriptUrl = $value === null ? null : '/' . trim($value, '/'); } private $_scriptFile; @@ -688,7 +688,7 @@ class Request extends \yii\base\Request */ public function setPathInfo($value) { - $this->_pathInfo = ltrim($value, '/'); + $this->_pathInfo = $value === null ? null : ltrim($value, '/'); } /**