mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 21:41:19 +08:00
Fixes #13501: Fixed yii\rbac\DbManager::getRule() and yii\rbac\DbManager::getRules() to properly handle resource data came from Rule table when using PostgreSQL
This commit is contained in:
committed by
Alexander Makarov
parent
25b78aa615
commit
97c43c2480
@ -631,7 +631,15 @@ class DbManager extends BaseManager
|
||||
->from($this->ruleTable)
|
||||
->where(['name' => $name])
|
||||
->one($this->db);
|
||||
return $row === false ? null : unserialize($row['data']);
|
||||
if ($row === false) {
|
||||
return null;
|
||||
}
|
||||
$data = $row['data'];
|
||||
if (is_resource($data)) {
|
||||
$data = stream_get_contents($data);
|
||||
}
|
||||
return unserialize($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -647,7 +655,11 @@ class DbManager extends BaseManager
|
||||
|
||||
$rules = [];
|
||||
foreach ($query->all($this->db) as $row) {
|
||||
$rules[$row['name']] = unserialize($row['data']);
|
||||
$data = $row['data'];
|
||||
if (is_resource($data)) {
|
||||
$data = stream_get_contents($data);
|
||||
}
|
||||
$rules[$row['name']] = unserialize($data);
|
||||
}
|
||||
|
||||
return $rules;
|
||||
|
||||
Reference in New Issue
Block a user