cmi classesnmm you are missingg 怎么解决

php - __PHP_Incomplete_Class_Name wrong - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 6.9 million programmers, just like you, helping each other.
J it only takes a minute:
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.
One such error is:
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
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' =& 'T08:05:22-0600',
'date' =& ' 08:05:22',
'timezone_type' =& 1,
'timezone' =& '-06:00',
'__strVirtualAttributeArray' =& array (),
'__blnRestored' =& true,
'objUser' =& NULL,
'objScorm' =& NULL,
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???
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.
Edit : 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, default session handler.
As written in the quote in your question __PHP_Incomplete_Class_Name is a special class name in PHP that is used whenever the class definition could not be found when unserializing ().
It's suggested to either ensure the class definition is available or to provide some autoloading for the missing class.
You commented that PHP is looking for the wrong classname here:
wrong: LoginLogging
right: ScormElement
It's hard to say with the information given why the classname is being changed on serialization/unserialization. The information you've given (especially the dump) in your question is incomplete.
So the options are limited to some general suggestions:
You could inspect the serialized string which classname is given in there so you could at least say if it happens with serialization or unserialization. You can easily inspect serialized data with the
which has a text-dumper for debug purposes.
Additionally there is the
you can use to further trace the problem.
$serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}';
// unserialize_callback_func directive available as of PHP 4.2.0
ini_set('unserialize_callback_func', 'mycallback'); // set your callback_function
function mycallback($classname)
// just include a file containing your classdefinition
// you get $classname to figure out which classdefinition is required
As you write the problem does not occur any longer, I suspect that at some point the serialization on your site was broken storing invalid data. Which framework/libraries/application are you using? Which component takes care about serialization?
139k26235430
If your trying to access a property method of an object or serialized value you've stored in a $_SESSION variable and you included the class after calling session_start()
try including the class before calling session_start();
Are you, by any chance, using some opcode cache (e.g. APC, XCache) or some debugger? They sometimes cause weird things to happen. If there isn't and never was a LoginLogging class in your project, but yours is not the only project on the server, I would bid on the cache.
This happens when we try to initialize the session before loading the class definitions for the object we are trying to save into the session.
you can use simply json methods in PHP
json_encode that array and again json_decode that array and save it in a variable and than print that variable. you will get a simple array.
$array = array(); // this is your array variable to whom you are trying to save in a session
$encode = json_encode($array);
$decode = json_decode($encode);
echo '&pre&';
print_r($decode);
it will work surely.
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');
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:
To include the class before the session_start() works fine for me. =)
When you try to unserialize a variable, php must know the structure of the object. Try to include your class before unserialize. Which class? the one that holds those properties shown in your code. include('pathtoyourclass/classname.php') or include_once('pathtoyourclass/classname.php').
Good luck!
It is the serialization issue in your code.It may be your code for some reason could not initialize the object and in next part of your code tries to convert that object to string or some other data type.
Just inspect your code, properly initialize your objects.
Check if you are using serialize()/unserialize() method.
Are you receiving this serialized object from a
service/stream or reading it from a file?
I've seen it happen in a client-server setting the client side object and the server side objects differ very slightly... maybe have a property that the other doesn't have.
This also happens when you serialize an object, save it to
file, then refactor code that removes a class and then try's to deserialize the object.
Then when it gets deserialized and tries to instantiate the needed classes they don't exist.
The error is clear and straightforward, you're creating a object for which the class has not been loaded.
I'd do a string search on your code, find where the needed class is located, and make a simple autoloader (or just a raw include/require) of the file.
Just get the class it needs loaded somehow.
If the class really doesn't exist anywhere, try checking earlier revisions (I'm assuming you have version control of some type) for existence of the class.
If you're deserializing an object generated by another system check that system out as well.
21.5k64483
I use this function to solve this problem
$user = $_SESSION['login'];
$auth_user= fixObject($user);
function fixObject(&$object) {
if (!is_object($object) && gettype($object) == 'object')
return ($object = unserialize(serialize($object)));
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
rev .25552
Stack Overflow works best with JavaScript enabled收藏到: &
(提示:頂到域名世界首頁,分享給更多網友)&&
歡迎您就本域名知識點留言評論!
您的姓名:
* 可選項,留空即為匿名發表
評論內容:
剩余字數:& * 按 Ctrl + Enter 直接發送.
域名世界提醒您:評論只需提交壹次,請耐心等候,審核後方可顯示.
精彩域名知識
域名世界推薦CMI Intoxilyzer | Breath Alcohol Testers and Supplies
Intoxilyzer 500.
Valve to prevent suck-backShatter resistant materialShape provides tighter sealLower backpressure & higher flow
Intoxilyzer 9000 & 8000 Mouthpiece
Intoxilyzer 240D.
CMI, Inc. is a leading manufacturer of breath alcohol testing instruments in the U.S., Canada and around the world.
CMI manufactures the Intoxilyzer(R) brand of evidential and preliminary breath alcohol measurement instruments.
CMI, Inc. is a wholly-owned subsidiary of MPD, Inc., also located in Owensboro, Kentucky.
MPD, Inc. is 100% employee owned through an Employee Stock Ownership Plan, (ESOP).
CMI is the industry leader in alcohol breath testing with the Intoxilyzer(R) line of evidential infrared spectrometry breath alcohol instruments. CMI is known for developing the best instruments for accuracy, reliability and courtroom evidence.
CMI handheld breath testers set the standard for performance, reliability, accuracy, and ease-of-use. Our handheld breath alcohol testers offer dependability with CMI’s leading-edge fuel cell technology, and are designed for dependable operation under the roughest conditions.
As an innovative industry leader for more than 30 years, CMI is proud to offer
the most accurate and reliable breath alcohol testing instruments to a wide range of industries including:
Our mission is to meet all of your breath alcohol testing program needs with a complete line of instruments and supplies and a comprehensive curriculum of training classes.}

我要回帖

更多关于 nmm you are missing 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信