Skip to content

Instantly share code, notes, and snippets.

@mbrowne
Created August 31, 2013 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbrowne/6395560 to your computer and use it in GitHub Desktop.
Save mbrowne/6395560 to your computer and use it in GitHub Desktop.
PHP serialization format for protected properties
class Test
{
protected $foo;
function __construct($foo) {
$this->foo = $foo;
}
}
$str = 'O:4:"Test":1:{s:6:"'."\0".'*'."\0".'foo";s:3:"bar";}';
$obj = unserialize($str);
var_dump($obj);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment