@ 2016-07-22T17:45:01Z <?php
class A {
public $y = 'b';
public $foo;
public $bar;
public $x = "A";
}
class B {
public $baz;
function __wakeup() {
echo "Within wakeup\n";
var_dump($this->baz);
echo "Done wakeup\n";
}
}
$a = new A();
$b = new B();
$a->foo = $b;
$a->bar = "something";
$b->baz = $a;
var_dump($a);
$unserialized = unserialize(serialize([$a]));
echo "After unserialize\n";
var_dump($unserialized);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.20 , 7.1.5 - 7.1.20 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 , 8.4.1 - 8.4.12 object(A)#1 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#2 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
Within wakeup
object(A)#3 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#4 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
Done wakeup
After unserialize
array(1) {
[0]=>
object(A)#3 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#4 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
}
Output for 7.0.0 - 7.0.9 , 7.1.0 object(A)#1 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#2 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
Within wakeup
object(A)#3 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#4 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
NULL
["x"]=>
string(1) "A"
}
Done wakeup
After unserialize
array(1) {
[0]=>
object(A)#3 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#4 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
}
Output for 5.6.9 - 5.6.23 object(A)#1 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#2 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
Within wakeup
object(A)#3 (4) {
["y"]=>
string(1) "b"
["foo"]=>
NULL
["bar"]=>
NULL
["x"]=>
string(1) "A"
}
Done wakeup
After unserialize
array(1) {
[0]=>
object(A)#3 (4) {
["y"]=>
string(1) "b"
["foo"]=>
object(B)#4 (1) {
["baz"]=>
*RECURSION*
}
["bar"]=>
string(9) "something"
["x"]=>
string(1) "A"
}
}
preferences:dark mode live preview ace vim emacs key bindings
140.86 ms | 411 KiB | 5 Q