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

Rule not found issue and fix #16669

Closed attybean closed 6 years ago

attybean commented 6 years ago

https://github.com/yiisoft/yii2/blob/9e5c4abdb8d99811b8c4fdc5dc376e22c9f0d662/framework/rbac/BaseManager.php#L275 Change line 275 from : if ($rule instanceof Rule) { to if ($rule instanceof \yii\rbac\Rule) {

as suggested in: [https://stackoverflow.com/questions/30278401/php-instanceof-returns-false-for-true-condition]

otherwise you can risk getting a false negative: Rule not found:

System Setup: PHP Version 7.0.31-1+0~ 20180725100222.2+jessie~1.gbp8e8a8b 10.1.26-MariaDB-0+deb9u1 - Debian 9.1 Apache/2.4.25 (Debian)

rob006 commented 6 years ago

It is fine as is - Rule actually points to yii\rbac\Rule, there is not need to use FQN here.