Advertisement
markuszeller

unserialize

Sep 4th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. spl_autoload_register(function ($class) {
  2.     var_dump("autoload: $class");
  3. });
  4.  
  5. /**
  6. class Foo
  7. {
  8.     public function __construct()
  9.     {
  10.         var_dump('called Foo::__construct');
  11.     }
  12. }
  13.  
  14. $foo = new Foo();
  15. var_dump(serialize($foo));
  16. */
  17.  
  18. $serialized = 'O:3:"Foo":0:{}';
  19. $foo = unserialize($serialized, ['allowed_classes' => false]);
  20. var_dump($foo);
  21.  
  22. /**
  23. class __PHP_Incomplete_Class#2 (1) {
  24.     public $__PHP_Incomplete_Class_Name =>
  25.     string(3) "Foo"
  26. }
  27. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement