<?php
class A {
protected $a;
public function __construct($a)
{
$this->a = $a;
}
public function getA()
{
return $this->a;
}
}
class B {
protected $name;
public function __construct($name)
{
$this->name = $name;
}
}
$b = new B('test');
$a = new A($b);
$a1 = new A($b);
$s = serialize(
array( // Acl:serialize (line 260)
[ // classFieldAces
'fieldOne' => [$a],
'fieldTwo' => [$a1],
]
)
);
var_dump($s);
$uns = unserialize($s);
var_dump($uns[0]['fieldOne'][0], $uns[0]['fieldTwo'][0]);
- Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- string(153) "a:1:{i:0;a:2:{s:8:"fieldOne";a:1:{i:0;O:1:"A":1:{s:4:" * a";O:1:"B":1:{s:7:" * name";s:4:"test";}}}s:8:"fieldTwo";a:1:{i:0;O:1:"A":1:{s:4:" * a";r:5;}}}}"
object(A)#4 (1) {
["a":protected]=>
object(B)#5 (1) {
["name":protected]=>
string(4) "test"
}
}
object(A)#6 (1) {
["a":protected]=>
object(B)#5 (1) {
["name":protected]=>
string(4) "test"
}
}
preferences:
199.94 ms | 405 KiB | 271 Q