Browse Source

Fixes #2051: Do not save null data into database when using RBAC

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
ab5d7bd54c
  1. 1
      framework/CHANGELOG.md
  2. 4
      framework/rbac/DbManager.php

1
framework/CHANGELOG.md

@ -74,6 +74,7 @@ Yii Framework 2 Change Log
- Enh #1973: `yii message/extract` is now able to generate `.po` files (SergeiKutanov, samdark)
- Enh #1984: ActionFilter will now mark event as handled when action run is aborted (cebe)
- Enh #2003: Added `filter` property to `ExistValidator` and `UniqueValidator` to support adding additional filtering conditions (qiangxue)
- Enh #2051: Do not save null data into database when using RBAC (qiangxue)
- Enh: Added `favicon.ico` and `robots.txt` to default application templates (samdark)
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
- Enh: Support for file aliases in console command 'message' (omnilight)

4
framework/rbac/DbManager.php

@ -449,7 +449,7 @@ class DbManager extends Manager
'type' => $type,
'description' => $description,
'biz_rule' => $bizRule,
'data' => serialize($data),
'data' => $data === null ? null : serialize($data),
])
->execute();
return new Item([
@ -496,7 +496,7 @@ class DbManager extends Manager
->queryOne();
if ($row !== false) {
if (($data = @unserialize($row['data'])) === false) {
if (!isset($row['data']) || ($data = @unserialize($row['data'])) === false) {
$data = null;
}
return new Item([

Loading…
Cancel
Save