Skip to content

Commit

Permalink
Fixes #13961: RBAC Rules: PostgreSQL: PHP Warning "unserialize() expe…
Browse files Browse the repository at this point in the history
…cts parameter 1 to be string, resource given" was fixed
  • Loading branch information
vsguts authored and samdark committed Apr 12, 2017
1 parent 510cd35 commit d2fb17f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Yii Framework 2 Change Log
- Enh #13560: Refactored `\yii\widgets\FragmentCache::getCachedContent()`, added tests (Kolyunya)
- Bug #13901: Fixed passing unused parameter to `formatMessage()` call in `\yii\validators\IpValidator` (Kolyunya)
- Enh #13945: Removed Courier New from error page fonts list since it looks bad on Linux (samdark)
- Bug #13961: RBAC Rules: PostgreSQL: PHP Warning "unserialize() expects parameter 1 to be string, resource given" was fixed (vsguts)

2.0.11.2 February 08, 2017
--------------------------
Expand Down
6 changes: 5 additions & 1 deletion framework/rbac/DbManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,11 @@ public function loadFromCache()
$query = (new Query)->from($this->ruleTable);
$this->rules = [];
foreach ($query->all($this->db) as $row) {
$this->rules[$row['name']] = unserialize($row['data']);
$data = $row['data'];
if (is_resource($data)) {
$data = stream_get_contents($data);
}
$this->rules[$row['name']] = unserialize($data);
}

$query = (new Query)->from($this->itemChildTable);
Expand Down

0 comments on commit d2fb17f

Please sign in to comment.