Commit ab5d7bd5 by Qiang Xue

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

parent 8e8eca36
...@@ -74,6 +74,7 @@ Yii Framework 2 Change Log ...@@ -74,6 +74,7 @@ Yii Framework 2 Change Log
- Enh #1973: `yii message/extract` is now able to generate `.po` files (SergeiKutanov, samdark) - 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 #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 #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 `favicon.ico` and `robots.txt` to default application templates (samdark)
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue) - Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
- Enh: Support for file aliases in console command 'message' (omnilight) - Enh: Support for file aliases in console command 'message' (omnilight)
......
...@@ -449,7 +449,7 @@ class DbManager extends Manager ...@@ -449,7 +449,7 @@ class DbManager extends Manager
'type' => $type, 'type' => $type,
'description' => $description, 'description' => $description,
'biz_rule' => $bizRule, 'biz_rule' => $bizRule,
'data' => serialize($data), 'data' => $data === null ? null : serialize($data),
]) ])
->execute(); ->execute();
return new Item([ return new Item([
...@@ -496,7 +496,7 @@ class DbManager extends Manager ...@@ -496,7 +496,7 @@ class DbManager extends Manager
->queryOne(); ->queryOne();
if ($row !== false) { if ($row !== false) {
if (($data = @unserialize($row['data'])) === false) { if (!isset($row['data']) || ($data = @unserialize($row['data'])) === false) {
$data = null; $data = null;
} }
return new Item([ return new Item([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment