#19842 [Opn->Bgs]: is_object returns FALSE on Incomplete classes
| From: | iliaa@php.net | Date: | Mon, 28 Oct 2002 16:22:20 +0000 |
| Subject: | #19842 [Opn->Bgs]: is_object returns FALSE on Incomplete classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-23567@lists.php.net to get a copy of this message | ||
ID: 19842
Updated by: iliaa@php.net
Reported By: alan@akbkhome.com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 4CVS-2002-10-10
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
It'll work flawlesly if you second script also contains the class
defention ( class atest { var $t = 1; } ). Without it the class
defenition, everything works properly with the exception of is_object,
which is failing due to the class atest not being defined.
Previous Comments:
------------------------------------------------------------------------
[2002-10-10 02:13:16] alan_k@php.net
variable object variables also fail on incomplete classes:
eg. (from the example below)
$data = unserialize(file_get_contents('/tmp/test'));
$key = 't';
var_dump($data->$key); // is blank.
//however
$ar = get_object_vars($data);
echo $ar[$key]; // produces 1
------------------------------------------------------------------------
[2002-10-10 01:55:22] alan@akbkhome.com
Steps to reproduce
a) generate a serialized class
eg.
class atest {
var $t = 1;
}
$t = new atest;
$fh = fopen('/tmp/test','w');
fwrite($fh,serialize($t));
fclose($fh);
----------------------
In another file
$data = unserialize(file_get_contents('/tmp/test'));
if (!is_object($data)) {
echo "DATA is an ".gettype($b)."!\n"; }
}
---- should output
DATA is an object!
It's on the verge of expected behaviour, but it would be nice if it
worked :)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19842&edit=1