Browse Source

Fixes #1296: stricter check of dashes in route.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
323008b177
  1. 2
      framework/yii/base/Controller.php

2
framework/yii/base/Controller.php

@ -194,7 +194,7 @@ class Controller extends Component implements ViewContextInterface
$actionMap = $this->actions(); $actionMap = $this->actions();
if (isset($actionMap[$id])) { if (isset($actionMap[$id])) {
return Yii::createObject($actionMap[$id], $id, $this); return Yii::createObject($actionMap[$id], $id, $this);
} elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) { } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id) && strpos($id, '--') === false && trim($id, '-') === $id) {
$methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id)))); $methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id))));
if (method_exists($this, $methodName)) { if (method_exists($this, $methodName)) {
$method = new \ReflectionMethod($this, $methodName); $method = new \ReflectionMethod($this, $methodName);

Loading…
Cancel
Save