Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Forked from anonymous/unserialize.php
Created March 3, 2014 22:11
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 rudiedirkx/9335754 to your computer and use it in GitHub Desktop.
Save rudiedirkx/9335754 to your computer and use it in GitHub Desktop.
<?php
class Oele {
function __construct() {
echo __METHOD__ . "\n";
}
function __wakeup() {
echo __METHOD__ . "\n";
}
}
$user = new Oele;
$user->oele = 'boele';
$user->x = 12344;
// $user = (object) array('oele' => 'boele', 'x' => 4523);
echo $serialized = serialize($user) . "\n\n";
$user = unserialize($serialized);
print_r($user);
class Boele {
function __construct() {
echo "FUCKER!\n";
}
function __wakeup() {
echo __METHOD__ . "\n";
}
}
$user = unserialize('O:5:"Boele":2:{s:4:"oele";s:5:"boele";s:1:"x";i:12344;}');
print_r($user);
echo var_export($user);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment