- unserialize: documentation ( source)
- serialize: documentation ( source)
<?php
class Kitchen
{
private $yummy = 'cake';
function __destruct() { if ($this->yummy == 'aaaa') echo 'win!'; }
}
$obj = new Kitchen();
$refObject = new ReflectionObject( $obj );
$refProperty = $refObject->getProperty( 'yummy' );
$refProperty->setAccessible( true );
$refProperty->setValue($refProperty, 'aaaa');
//var_dump($refProperty);
//var_dump($refProperty);
unserialize(serialize($refProperty));