Skip to content

Instantly share code, notes, and snippets.

@shin1x1
Created November 18, 2010 02:27
Show Gist options
  • Save shin1x1/704544 to your computer and use it in GitHub Desktop.
Save shin1x1/704544 to your computer and use it in GitHub Desktop.
<?php
class Foo {
public $value = 'abc';
public function __wakeup() {
echo(__LINE__.' '.__METHOD__).PHP_EOL;
}
public function __destruct() {
echo(__LINE__.' '.__METHOD__).PHP_EOL;
}
}
/*
$obj = new Foo();
echo serialize($obj);
*/
function func($text) {
echo(__LINE__.' before unserialize').PHP_EOL;
$a = unserialize($text);
echo(__LINE__.' after unserialize').PHP_EOL;
}
echo(__LINE__.' before func').PHP_EOL;
func('O:3:"Foo":1:{s:5:"value";s:3:"abc";}');
echo(__LINE__.' end').PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment