__PHP_Incomplete_Class_Name错误 [英] __PHP_Incomplete_Class_Name wrong

查看:211
本文介绍了__PHP_Incomplete_Class_Name错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们随机得到一些非常奇怪的错误日志.即使在具有相同参数/操作/等的情况下,也不会在每次命中页面时发生这种情况,而且它们似乎也不是可重复的,每个崩溃位置和上下文都不同.但是几乎所有原因都有不正确的__PHP_Incomplete_Class_Name作为原因.

We're randomly getting some very strange error logs. They don't happen on every page hit, even with the same parameters/actions/etc, and they don't seem repeatable, each one is different in its crash location, and context. But almost all have incorrect __PHP_Incomplete_Class_Name as the cause.

一个这样的错误是:

main():脚本试图执行方法或访问不完整对象的属性.请确保在 调用unserialize()之前已加载要尝试操作的对象的类定义"LoginLogging",或提供__autoload()函数来加载类定义

main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "LoginLogging" of the object you are trying to operate on was loaded before unserialize() gets called or provide a __autoload() function to load the class definition

问题是,没有"LoginLogging"类.它所指向的对象在保存到会话中时为ScormElement类型. 转储变量会给出:

The problem being, there is no "LoginLogging" class. The object it's referring to was of type ScormElement when it was saved into the session. Doing a dump of the variable gives:

__PHP_Incomplete_Class::__set_state(array(
 '__PHP_Incomplete_Class_Name' => 'LoginLogging',
 'intUserId' => '64576',
 '__intUserId' => '64576',
 'intScormId' => '665',
 '__intScormId' => '665',
 'intScoId' => '9255',
 '__intScoId' => '9255',
 'strElement' => 'cmi.core.lesson_location',
 '__strElement' => 'cmi.core.lesson_location',
 'strValue' => '1',
 'dttTimeModified' => QDateTime::__set_state(array(
   'blnDateNull' => false,
   'blnTimeNull' => false,
   'strSerializedData' => '2011-08-31T08:05:22-0600',
   'date' => '2011-08-31 08:05:22',
   'timezone_type' => 1,
   'timezone' => '-06:00',
 )),
 '__strVirtualAttributeArray' => array (),
 '__blnRestored' => true,
 'objUser' => NULL,
 'objScorm' => NULL,
)

所有属性均正确保留,并与ScormElement的类定义匹配.但是类名是错误的.没有 没有名为LoginLogging的类.

All the properties are retained correctly, and match the class definition for ScormElement. But the class name is wrong. There is no class named LoginLogging.

是什么原因造成的,我们如何解决呢?

What is causing this and how do we fix it???

编辑:这只是一个示例.其他错误在结构上非常相似,但是会影响其他类类型,并且具有不同的不完整名称.但是,所有不完整的名称都具有与正确的类名称相同的字符串 length .

Edit: This is just an example. Other errors are very similar in structure, but affect other class types, and have different incomplete names. However, ALL incomplete names have the same string length of the correct class name.

编辑2011-10-27 :我仍然看到这些错误日志,但未成功找到解决方案.任何帮助将不胜感激.

Edit 2011-10-27: I'm still seeing these error logs, and have had no success in finding a solution. Any help would be appreciated.

PHP 5.3.3,APC,默认会话处理程序.

PHP 5.3.3, APC, default session handler.

推荐答案

哈克雷(Hakre)看session_write_close的建议使我想到了一个可靠的解决方法:

Hakre's suggestion to look at session_write_close led me to what appears to be a reliable fix:

register_shutdown_function('session_write_close');

这将强制在任何内存清理和类卸载发生之前将会话写出.这一点很重要,因为PHP发生了变化,可能会导致APC删除类引用与PHP写入会话数据之间出现竞争状态: http://news.php.net/php.internals/46999

This forces the session to be written out before any memory cleanup and class unloading occurs. This is important due to a change in PHP that can result in a race condition between APC removing class references and PHP writing out the session data: http://news.php.net/php.internals/46999

这篇关于__PHP_Incomplete_Class_Name错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆