mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Fix #18487: Allow creating URLs for non-GET-verb rules
This commit is contained in:
@ -14,6 +14,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #18479: Fix invalid argument type for `preg_split` in `\yii\console\Controller` (gazooz)
|
||||
- Bug #18477: Fix detecting availability of Xdebug's stack trace in `yii\base\ErrorException` (bizley)
|
||||
- Bug #18480: Transactions are not committed using the dblib driver (bbrunekreeft)
|
||||
- Enh #18487: Allow creating URLs for non-GET-verb rules (bizley)
|
||||
|
||||
|
||||
2.0.40 December 23, 2020
|
||||
|
||||
@ -205,9 +205,6 @@ class UrlRule extends CompositeUrlRule
|
||||
$config['verb'] = $verbs;
|
||||
$config['pattern'] = rtrim($prefix . '/' . strtr($pattern, $this->tokens), '/');
|
||||
$config['route'] = $action;
|
||||
if (!empty($verbs) && !in_array('GET', $verbs)) {
|
||||
$config['mode'] = WebUrlRule::PARSING_ONLY;
|
||||
}
|
||||
$config['suffix'] = $this->suffix;
|
||||
|
||||
return Yii::createObject($config);
|
||||
|
||||
@ -245,10 +245,6 @@ class UrlManager extends Component
|
||||
$rule = ['route' => $rule];
|
||||
if (preg_match("/^((?:($verbs),)*($verbs))\\s+(.*)$/", $key, $matches)) {
|
||||
$rule['verb'] = explode(',', $matches[1]);
|
||||
// rules that are not applicable for GET requests should not be used to create URLs
|
||||
if (!in_array('GET', $rule['verb'], true)) {
|
||||
$rule['mode'] = UrlRule::PARSING_ONLY;
|
||||
}
|
||||
$key = $matches[4];
|
||||
}
|
||||
$rule['pattern'] = $key;
|
||||
|
||||
Reference in New Issue
Block a user