mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-16 22:39:52 +08:00
Fixes issue #337: support strict parsing for URL manager.
This commit is contained in:
@@ -26,6 +26,12 @@ class UrlManager extends Component
|
||||
* "/index.php?r=news/view&id=100".
|
||||
*/
|
||||
public $enablePrettyUrl = false;
|
||||
/**
|
||||
* @var boolean whether to enable strict parsing. If strict parsing is enabled, the incoming
|
||||
* requested URL must match at least one of the [[rules]] in order to be treated as a valid request.
|
||||
* This property is used only when [[enablePrettyUrl]] is true.
|
||||
*/
|
||||
public $enableStrictParsing = false;
|
||||
/**
|
||||
* @var array the rules for creating and parsing URLs when [[enablePrettyUrl]] is true.
|
||||
* This property is used only if [[enablePrettyUrl]] is true. Each element in the array
|
||||
@@ -139,6 +145,10 @@ class UrlManager extends Component
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->enableStrictParsing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$suffix = (string)$this->suffix;
|
||||
if ($suffix !== '' && $suffix !== '/' && $pathInfo !== '') {
|
||||
$n = strlen($this->suffix);
|
||||
|
||||
Reference in New Issue
Block a user