From: [EMAIL PROTECTED]
Operating system: Linux
PHP version: 5CVS-2004-09-05 (dev)
PHP Bug Type: Session related
Bug description: unserialize()/ __PHP_Incomplete_class does not report correctly
class name
Description:
------------
The idea is that when an object is unserialized and the class definition
is still not loaded then it is converted to __PHP_Incomplete_Class
class. From the dump of the actual result one can see that the name is
stored in a member variable __PHP_Incomplete_Class_Name. So far everything
looks ok. But when one tries to execute a method on incomplete class object
it leads to a fatal error. This is also correct. However the name of the
class is "unknown" is the message. This is not correct and the example
works with PHP 4.3.8(cli). However does not work with current HEAD
(probably not with the PHP_5 branch).
One additional thing is that the message is misleading. A serialized
object may not come always from a session but can be loaded from a file by
the user or ,like in my case where I found the error, from a socket.
Thanks
Reproduce code:
---------------
php -r 'class foo{function someFunc(){} var $someProp=2;}$a=serialize(new
foo());$b=str_replace('foo','bar', $a);var_dump($c =
unserialize($b));$c->someFunc();'
Expected result:
----------------
object(__PHP_Incomplete_Class)#1 (2) {
["__PHP_Incomplete_Class_Name"]=>
string(3) "bar"
["someProp"]=>
int(2)
}
Fatal error: Unknown: The script tried to execute a method or access a
property of an incomplete object. Please ensure that the class definition
<b>bar</b> of the object you are trying to operate on was loaded _before_
the session was started in Command line code on line 1
Actual result:
--------------
object(__PHP_Incomplete_Class)#1 (2) {
["__PHP_Incomplete_Class_Name"]=>
string(3) "bar"
["someProp"]=>
int(2)
}
Fatal error: Unknown: The script tried to execute a method or access a
property of an incomplete object. Please ensure that the class definition
<b>unknown</b> of the object you are trying to operate on was loaded
_before_ the session was started in Command line code on line 1
--
Edit bug report at http://bugs.php.net/?id=29985&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29985&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29985&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29985&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29985&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29985&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29985&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29985&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29985&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29985&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29985&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29985&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29985&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29985&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29985&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29985&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29985&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29985&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29985&r=float