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(
  "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)