From bee82b29addd2d543d8acef7075f820b41b847c7 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 7 Jan 2014 04:40:38 +0400 Subject: [PATCH] Fixed URL parsing so it's now properly giving 404 for URLs like `http://example.com//////site/about` --- framework/CHANGELOG.md | 1 + framework/yii/web/Request.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 4deabe2..1eab4f3 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -28,6 +28,7 @@ Yii Framework 2 Change Log - Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe) - Bug: Fixed issue with tabular input on ActiveField::radio() and ActiveField::checkbox() (jom) - Bug: Fixed the issue that query cache returns the same data for the same SQL but different query methods (qiangxue) +- Bug: Fixed URL parsing so it's now properly giving 404 for URLs like `http://example.com//////site/about` (samdark) - Enh #46: Added Image extension based on [Imagine library](http://imagine.readthedocs.org) (tonydspaniard) - Enh #364: Improve Inflector::slug with `intl` transliteration. Improved transliteration char map. (tonydspaniard) - Enh #797: Added support for validating multiple columns by `UniqueValidator` and `ExistValidator` (qiangxue) diff --git a/framework/yii/web/Request.php b/framework/yii/web/Request.php index f38bd0d..b8c2a59 100644 --- a/framework/yii/web/Request.php +++ b/framework/yii/web/Request.php @@ -584,7 +584,11 @@ class Request extends \yii\base\Request throw new InvalidConfigException('Unable to determine the path info of the current request.'); } - return ltrim($pathInfo, '/'); + if ($pathInfo[0] === '/') { + $pathInfo = substr($pathInfo, 1); + } + + return $pathInfo; } /**