#36422 [Opn->Csd]: unserialize() __autoloads invalid objects
| From: | colder@php.net | Date: | Fri, 08 Sep 2006 09:10:15 +0000 |
| Subject: | #36422 [Opn->Csd]: unserialize() __autoloads invalid objects | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969373955@lists.php.net to get a copy of this message | ||
ID: 36422
Updated by: colder@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: WinXP
PHP Version: 5.1.2
-Assigned To:
+Assigned To: colder
New Comment:
Note is now integrated in the manual.
Previous Comments:
------------------------------------------------------------------------
[2006-02-17 11:42:58] colder@php.net
It is an object, but not a valid one. The object is not expected to
work, so is_object() will return false.
It's already stated in the user comments:
http://php.net/is_object#59209
------------------------------------------------------------------------
[2006-02-17 10:22:33] tomas_matousek at hotmail dot com
An what is it if it is not an object? Array? Some new PHP type? So, why
var_dump reports is as object?
This:
var_dump(gettype($o));
var_dump($o->__PHP_Incomplete_Class_Name);
displays:
string(6) "object"
NULL
------------------------------------------------------------------------
[2006-02-16 20:59:07] tony2001@php.net
This is expected, as object of __PHP_Incomplete_Class is actually not
valid object.
Reclassified as docu problem.
------------------------------------------------------------------------
[2006-02-16 20:36:56] tomas_matousek at hotmail dot com
Description:
------------
When unserialize calls __autoload() and this dosn't load the required
class unserialize returns an object that doesn't behave like object;
var_dump displays it as an object but is_object gives false.
Reproduce code:
---------------
function __autoload($class_name)
{
}
var_dump($o = unserialize('O:1:"X":0:{}'));
var_dump(is_object($o));
Expected result:
----------------
object(__PHP_Incomplete_Class)#1 (1) {
["__PHP_Incomplete_Class_Name"]=>
string(1) "X"
}
bool(true)
Actual result:
--------------
object(__PHP_Incomplete_Class)#1 (1) {
["__PHP_Incomplete_Class_Name"]=>
string(1) "X"
}
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36422&edit=1