5.0.0 - 严重 - 已处理
5.1.34 LTS在模型里直接写
$this->save(['username'=>'abc123']);
会直接触发下面的代码段,导致返回false,新版不save方法不支持直接传递数据了吗?看github上显示的好像是今天刚刚修改提交的。提交注释是 “改进save和delete方法的为空判断”
if ($this->isEmpty() || !$this->checkBeforeSave($data, $where)) {
return false;
}public function save($data = [], $where = [], $sequence = null)
{
if (is_string($data)) {
$sequence = $data;
$data = [];
}
if ($this->isEmpty() || !$this->checkBeforeSave($data, $where)) {
return false;
}
$result = $this->exists ? $this->updateData($where) : $this->insertData($sequence);
if (false === $result) {
return false;
}
// 写入回调
$this->trigger('after_write');
// 重新记录原始数据
$this->origin = $this->data;
$this->set = [];
return true;
} 