PHP, 原创,

仅记录使用CodeIgniter4(CI4)遇到的BUG(1)

1.System/Entity.php 173行报错,报错原因使用的变量没有定义

"title": "ErrorException",
"type": "ErrorException",
"code": 500,
"message": "Undefined index: xxxx",
"file": "/system/Entity.php",
"line": 173,

修复此BUG,修改此行

if ($onlyChanged && $this->_original[$key] === null && $value === null)

修改为

if ($onlyChanged && ! isset($this->_original[$key]) && $value === null)

因为变量 $this->_original[$key] 不存在,直接使用会抛出异常。

(246)

Related Post