Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Foo
- {
- private $bar = "boo";
- private $baz = "buz";
- }
- $foo = new Foo();
- $tmp = serialize($foo);
- $nul = preg_quote(chr(0));
- $reg = "/s\:([0-9]+)\:\"$nul(.*?)$nul/";
- preg_match_all($reg, $tmp, $matches);
- foreach ($matches[0] as $i => $match) {
- $class = $matches[2][$i];
- $clen = strlen($class);
- $len = intval($matches[1][$i]) - ($clen + 2);
- $tmp = str_replace($match, "s:$len:\"", $tmp);
- $tmp = str_replace("O:$clen:\"$class\"", "O:8:\"stdClass\"", $tmp);
- }
- $tmp = unserialize($tmp);
- echo $tmp->bar;
- echo "\n";
- die;
Add Comment
Please, Sign In to add comment