yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Missing quotes for table name and column name in DBManager, line 351 #6172

Closed ncthuc closed 9 years ago

ncthuc commented 9 years ago

I found an error in this file https://github.com/yiisoft/yii2/blob/master/framework/rbac/DbManager.php, line 351 that misses quotes table & column name in statement 'a.item_name=b.name'

$query = (new Query)->select('b.*')
            ->from(['a' => $this->assignmentTable, 'b' => $this->itemTable])
            ->where('a.item_name=b.name')
            ->andWhere(['a.user_id' => (string)$userId]);

This causes error for me when using Oracle because it'll automatically turn to UPPERCASE A.ITEM_NAME=B.NAME

I edited it to '{{a}}.{{item_name}}={{b}}.{{name}}', it works for me, but I don't want to change the source code of the framework

Can you please fix this in your code?

qiangxue commented 9 years ago

Thanks!