The __PHP_Incomplete_Class class
The __PHP_Incomplete_Class class
Created by
when trying to unserialize an undefined class
or a class that is not listed in the
of 's array.
unserialize``allowed_classes``unserialize``options
Prior to PHP 7.2.0, using on the
class would return false.
As of PHP 7.2.0, true will be returned.
is_object``__PHP_Incomplete_Class
__PHP_Incomplete_Class
This class has no default properties or methods.
When created by ,
in addition to all unserialized properties and values
the object will have a property
which will contain the name of the unserialized class.
unserialize``__PHP_Incomplete_Class_Name
**Voorbeeld: Created by **
<?php
class MyClass
{
public string $property = "myValue";
}
$myObject = new MyClass;
$foo = serialize($myObject);
// unserializes all objects into __PHP_Incomplete_Class objects
$disallowed = unserialize($foo, ["allowed_classes" => false]);
var_dump($disallowed);
// unserializes all objects into __PHP_Incomplete_Class objects except those of MyClass2 and MyClass3
$disallowed2 = unserialize($foo, ["allowed_classes" => ["MyClass2", "MyClass3"]]);
var_dump($disallowed2);
// unserializes undefined class into __PHP_Incomplete_Class object
$undefinedClass = unserialize('O:16:"MyUndefinedClass":0:{}');
var_dump($undefinedClass);
object(__PHP_Incomplete_Class)#2 (2) {
["__PHP_Incomplete_Class_Name"]=>
string(7) "MyClass"
["property"]=>
string(7) "myValue"
}
object(__PHP_Incomplete_Class)#3 (2) {
["__PHP_Incomplete_Class_Name"]=>
string(7) "MyClass"
["property"]=>
string(7) "myValue"
}
object(__PHP_Incomplete_Class)#4 (1) {
["__PHP_Incomplete_Class_Name"]=>
string(16) "MyUndefinedClass"
}