From 831e51153bad30aa4976724c135027da63fcad92 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 30 Nov 2013 15:52:22 -0500 Subject: [PATCH] proper check of "db" property of ActiveDataProvider. --- framework/yii/data/ActiveDataProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/yii/data/ActiveDataProvider.php b/framework/yii/data/ActiveDataProvider.php index 8c69230..df568a8 100644 --- a/framework/yii/data/ActiveDataProvider.php +++ b/framework/yii/data/ActiveDataProvider.php @@ -86,9 +86,9 @@ class ActiveDataProvider extends BaseDataProvider parent::init(); if (is_string($this->db)) { $this->db = Yii::$app->getComponent($this->db); - if (!$this->db instanceof Connection) { - throw new InvalidConfigException('The "db" property must be a valid DB Connection application component.'); - } + } + if ($this->db === null) { + throw new InvalidConfigException('The "db" property must be a valid DB Connection application component.'); } }