- unserialize: documentation ( source)
- serialize: documentation ( source)
<?php
$foo = new class {
public function Bar () {
echo 'bar';
}
};
// This succeeds. I'd argue an error should be generated at this point
echo $serFoo = serialize($foo);
// Unserialize fails and a notice is generated
$unFoo = unserialize($serFoo);
// Error generated on call
$unFoo->Bar();