|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19842 is_object returns FALSE on Incomplete classes
Submitted: 2002-10-10 01:55 UTC Modified: 2002-10-28 10:22 UTC
From: alan at akbkhome dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4CVS-2002-10-10 OS: linux
Private report: No CVE-ID: None
 [2002-10-10 01:55 UTC] alan at akbkhome dot com
Steps to reproduce
a) generate a serialized class
class atest {
  var $t = 1;
$t = new atest;
$fh = fopen('/tmp/test','w');
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 :)



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-10 02:13 UTC]
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.
$ar = get_object_vars($data);
echo $ar[$key]; // produces 1

 [2002-10-28 10:22 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 19:01:29 2024 UTC