3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $foo = 123; } class Bar {} $foo = new Foo(); $serializedFoo = serialize($foo); $unserializedFoo = unserialize($serializedFoo, ['allowed_classes' => [Bar::class]]); var_dump($serializedFoo, $unserializedFoo);
Output for 7.1.6
string(33) "O:3:"Foo":1:{s:6:"*foo";i:123;}" object(__PHP_Incomplete_Class)#2 (2) { ["__PHP_Incomplete_Class_Name"]=> string(3) "Foo" ["foo":protected]=> int(123) }