Kohana ORM find_all pk() 函数 return NULL PHP 5.6.21
Kohana ORM find_all pk() function return NULL in PHP 5.6.21
我有以下代码,多年来一直运行良好,但自从我升级到 PHP 5.6.21 后,它的 return NULL。
$model = new Model_Status ();
$results = $model->find_all ();
foreach ( $results as $result ) {
echo $result->pk ();
}
当我在服务器 运行 上回显 $result PHP 来自 mysql 的 5.6.20 行数据加载到 $_original_values、$_primary_key_value 和$_changed 为空,但在 PHP 5.6.21 中,$_primary_key_value 和 $_original_values 为空,并且 _changed 具有数据库列的值
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 中显示为卸载对象的变化值。
Here is link of Kohana ORM issue
Here is link to PHP bug report
我有以下代码,多年来一直运行良好,但自从我升级到 PHP 5.6.21 后,它的 return NULL。
$model = new Model_Status ();
$results = $model->find_all ();
foreach ( $results as $result ) {
echo $result->pk ();
}
当我在服务器 运行 上回显 $result PHP 来自 mysql 的 5.6.20 行数据加载到 $_original_values、$_primary_key_value 和$_changed 为空,但在 PHP 5.6.21 中,$_primary_key_value 和 $_original_values 为空,并且 _changed 具有数据库列的值
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 中显示为卸载对象的变化值。
Here is link of Kohana ORM issue Here is link to PHP bug report