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:

$object = unserialize(



The result is:

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