我有以下代码,多年来它一直运行良好,但自从我升级到PHP 5.6.21后,它返回NULL。
$model = new Model_Status ();
$results = $model->find_all ();
foreach ( $results as $result ) {
echo $result->pk ();
}
当我在运行PHP 5.6.20的服务器上回显$result时,mysql中的行数据加载在$_original_values中,$_primary_key_value和$_changed为空,但在PHP 5.6.21中,$.primary_key_value、$_origina _values为空,_changed具有DB列的值
echo Debug::vars($result)
//php 5.6.20
protected _object => array(6) (
"id" => string(1) "1"
"name" => string(4) "Live"
"code" => string(3) "401"
"message" => string(12) "site is live"
"created" => NULL
"modified" => NULL
)
protected _changed => array(0)
protected _original_values => array(6) (
"id" => string(1) "1"
"name" => string(4) "Live"
"code" => string(3) "401"
"message" => string(12) "site is live"
"created" => NULL
"modified" => NULL
)
//php 5.6.21
protected _object => array(6) (
"id" => string(1) "1"
"name" => string(4) "Live"
"code" => string(3) "401"
"message" => string(12) "site is live"
"created" => NULL
"modified" => NULL
)
protected _changed => array(4) (
"id" => string(2) "id"
"name" => string(4) "name"
"code" => string(2) "code"
"message" => string(7) "message"
)
protected _original_values => array(0)
此问题是由PHP 5.6.21中的更新引起的,它在PHP 7.0.5中的行为相同mysqli_fetch_object
或mysqli_result::fetch_object
的行为是更改及其在赋值之前调用的构造函数,因此这些值在Kohana ORM中显示为卸载对象的更改值。
这是Kohana ORM问题的链接以下是PHP错误报告的链接