# `is_object()` and Incomplete Classes

> Section in “New and Extended Functionality › Language Features” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/language-features/is_object-and-incomplete-classes/>

Even though we think that incomplete classes are not object instances, PHP –as of version 7.2– tends to disagree with us. Before PHP 7.2, when calling `is_object()` on an incomplete class, you would get `false` as a result. Now the answer is `true`. We think that this is at least arguable, since you are unable to call methods on incomplete classes, but still this is how PHP behaves today:

``` php
$object = unserialize(
  "O:9:\"Something\":1:{s:14:\"\000Something\000foo\";i:42;}"
);

var_dump($object);

var_dump(is_object($object));
```

The result is:

    class __PHP_Incomplete_Class#1 (2) {
      public $__PHP_Incomplete_Class_Name => string(9) "Something"
      private $foo => int(42)
    }

    bool(true)

---

Previous: [Custom Object Serialization](https://php7explained.com/new-and-extended-functionality/language-features/custom-object-serialization/index.html.md) | Next: [Null Coalesce Operator](https://php7explained.com/new-and-extended-functionality/language-features/null-coalesce-operator/index.html.md)
