From 67dd874e0c4b5d3bfd8d61bae6cdcdc1f1c612be Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 26 Mar 2014 17:15:32 +0100 Subject: [PATCH 1/3] renamed console controller optoins param $id to $actionId --- build/controllers/PhpDocController.php | 4 ++-- extensions/apidoc/commands/ApiController.php | 4 ++-- extensions/apidoc/commands/GuideController.php | 4 ++-- extensions/apidoc/components/BaseController.php | 4 ++-- extensions/faker/FixtureController.php | 7 +++---- framework/base/View.php | 1 - framework/caching/MemCache.php | 1 + framework/console/Controller.php | 4 ++-- framework/console/controllers/FixtureController.php | 9 ++++----- framework/console/controllers/MigrateController.php | 9 ++++----- framework/helpers/BaseHtml.php | 2 +- 11 files changed, 23 insertions(+), 26 deletions(-) diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index 32c4e62..f584390 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -115,9 +115,9 @@ class PhpDocController extends Controller /** * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), ['updateFiles']); + return array_merge(parent::options($actionId), ['updateFiles']); } protected function updateClassPropertyDocs($file, $className, $propertyDoc) diff --git a/extensions/apidoc/commands/ApiController.php b/extensions/apidoc/commands/ApiController.php index fb16078..9c9e286 100644 --- a/extensions/apidoc/commands/ApiController.php +++ b/extensions/apidoc/commands/ApiController.php @@ -159,8 +159,8 @@ class ApiController extends BaseController /** * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), ['template', 'guide']); + return array_merge(parent::options($actionId), ['template', 'guide']); } } diff --git a/extensions/apidoc/commands/GuideController.php b/extensions/apidoc/commands/GuideController.php index 933e76b..754d49d 100644 --- a/extensions/apidoc/commands/GuideController.php +++ b/extensions/apidoc/commands/GuideController.php @@ -114,8 +114,8 @@ class GuideController extends BaseController /** * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), ['apiDocs']); + return array_merge(parent::options($actionId), ['apiDocs']); } } diff --git a/extensions/apidoc/components/BaseController.php b/extensions/apidoc/components/BaseController.php index 9d700b2..e62ef37 100644 --- a/extensions/apidoc/components/BaseController.php +++ b/extensions/apidoc/components/BaseController.php @@ -126,8 +126,8 @@ abstract class BaseController extends Controller /** * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), ['template', 'exclude']); + return array_merge(parent::options($actionId), ['template', 'exclude']); } } diff --git a/extensions/faker/FixtureController.php b/extensions/faker/FixtureController.php index b7134a6..fbc3a2b 100644 --- a/extensions/faker/FixtureController.php +++ b/extensions/faker/FixtureController.php @@ -171,12 +171,11 @@ class FixtureController extends \yii\console\controllers\FixtureController /** - * Returns the names of the global options for this command. - * @return array the names of the global options for this command. + * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), [ + return array_merge(parent::options($actionId), [ 'templatePath', 'language', 'fixtureDataPath' ]); } diff --git a/framework/base/View.php b/framework/base/View.php index c52da26..8693455 100644 --- a/framework/base/View.php +++ b/framework/base/View.php @@ -141,7 +141,6 @@ class View extends Component public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); - return $this->renderFile($viewFile, $params, $context); } diff --git a/framework/caching/MemCache.php b/framework/caching/MemCache.php index 8dd5755..bf8c8d8 100644 --- a/framework/caching/MemCache.php +++ b/framework/caching/MemCache.php @@ -78,6 +78,7 @@ class MemCache extends Cache */ private $_servers = []; + /** * Initializes this application component. * It creates the memcache instance and adds memcache servers. diff --git a/framework/console/Controller.php b/framework/console/Controller.php index aa54a62..cf39ed1 100644 --- a/framework/console/Controller.php +++ b/framework/console/Controller.php @@ -264,10 +264,10 @@ class Controller extends \yii\base\Controller * Note that the values setting via options are not available * until [[beforeAction()]] is being called. * - * @param string $id action name + * @param string $actionId the action id of the current request * @return array the names of the options valid for the action */ - public function options($id) + public function options($actionId) { // $id might be used in subclass to provide options specific to action id return ['color', 'interactive']; diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index f727bbd..f1c72b6 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -33,7 +33,6 @@ use yii\test\FixtureTrait; */ class FixtureController extends Controller { - use FixtureTrait; /** @@ -57,13 +56,13 @@ class FixtureController extends Controller 'yii\test\InitDb', ]; + /** - * Returns the names of the global options for this command. - * @return array the names of the global options for this command. + * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), [ + return array_merge(parent::options($actionId), [ 'namespace', 'globalFixtures' ]); } diff --git a/framework/console/controllers/MigrateController.php b/framework/console/controllers/MigrateController.php index 4ed1435..e649b66 100644 --- a/framework/console/controllers/MigrateController.php +++ b/framework/console/controllers/MigrateController.php @@ -92,14 +92,13 @@ class MigrateController extends Controller public $db = 'db'; /** - * Returns the names of the global options for this command. - * @return array the names of the global options for this command. + * @inheritdoc */ - public function options($id) + public function options($actionId) { - return array_merge(parent::options($id), + return array_merge(parent::options($actionId), ['migrationPath', 'migrationTable', 'db'], // global for all actions - ($id == 'create') ? ['templateFile'] : [] // action create + ($actionId == 'create') ? ['templateFile'] : [] // action create ); } diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index ca12d27..07f4ed5 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -342,7 +342,7 @@ class BaseHtml /** * Generates an image tag. - * @param string $src the image URL. This parameter will be processed by [[yii\helpers\Url::to()]]. + * @param array|string $src the image URL. This parameter will be processed by [[yii\helpers\Url::to()]]. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. * If a value is null, the corresponding attribute will not be rendered. From 27659d177629210b63feed0e8a260cf4727c9f78 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 26 Mar 2014 17:50:54 +0100 Subject: [PATCH 2/3] fixed FileHelper private method static call --- framework/data/ArrayDataProvider.php | 1 + framework/db/ActiveQuery.php | 1 + framework/helpers/BaseFileHelper.php | 4 ++-- framework/web/Request.php | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/data/ArrayDataProvider.php b/framework/data/ArrayDataProvider.php index bc5a5bc..a9e1d5a 100644 --- a/framework/data/ArrayDataProvider.php +++ b/framework/data/ArrayDataProvider.php @@ -64,6 +64,7 @@ class ArrayDataProvider extends BaseDataProvider */ public $allModels; + /** * @inheritdoc */ diff --git a/framework/db/ActiveQuery.php b/framework/db/ActiveQuery.php index 0590454..4cb011b 100644 --- a/framework/db/ActiveQuery.php +++ b/framework/db/ActiveQuery.php @@ -91,6 +91,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface */ public $joinWith; + /** * Executes query and returns all results as an array. * @param Connection $db the DB connection used to create the DB command. diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php index 74b04ab..29f05ef 100644 --- a/framework/helpers/BaseFileHelper.php +++ b/framework/helpers/BaseFileHelper.php @@ -285,14 +285,14 @@ class BaseFileHelper if (isset($options['except'])) { foreach ($options['except'] as $key => $value) { if (is_string($value)) { - $options['except'][$key] = static::parseExcludePattern($value); + $options['except'][$key] = self::parseExcludePattern($value); } } } if (isset($options['only'])) { foreach ($options['only'] as $key => $value) { if (is_string($value)) { - $options['only'][$key] = static::parseExcludePattern($value); + $options['only'][$key] = self::parseExcludePattern($value); } } } diff --git a/framework/web/Request.php b/framework/web/Request.php index 87a425b..75c7407 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -124,8 +124,8 @@ class Request extends \yii\base\Request */ public $enableCookieValidation = true; /** - * @var string|boolean the name of the POST parameter that is used to indicate if a request is a PUT, PATCH or DELETE - * request tunneled through POST. Default to '_method'. + * @var string the name of the POST parameter that is used to indicate if a request is a PUT, PATCH or DELETE + * request tunneled through POST. Defaults to '_method'. * @see getMethod() * @see getBodyParams() */ From d1663a5fb7b03f64e49472eff4bc43a4ad0676e2 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 26 Mar 2014 17:51:19 +0100 Subject: [PATCH 3/3] fixed potential problem with MessageFormatter and broken messages --- framework/i18n/MessageFormatter.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/i18n/MessageFormatter.php b/framework/i18n/MessageFormatter.php index 0708f69..893322f 100644 --- a/framework/i18n/MessageFormatter.php +++ b/framework/i18n/MessageFormatter.php @@ -220,7 +220,9 @@ class MessageFormatter extends Component if (!isset($token[2])) { return false; } - $subtokens = self::tokenizePattern($token[2]); + if (($subtokens = self::tokenizePattern($token[2])) === false) { + return false; + } $c = count($subtokens); for ($k = 0; $k + 1 < $c; $k++) { if (is_array($subtokens[$k]) || !is_array($subtokens[++$k])) {