Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- bug #70321 (Magic getter breaks reference to array property) --FILE-- <?php class..
Decoded Output download
--TEST--
bug #70321 (Magic getter breaks reference to array property)
--FILE--
<?php
class foo implements arrayAccess
{
private $bar;
public function __construct()
{
$this->bar = new bar();
}
public function & __get($key)
{
$bar = $this->bar;
return $bar;
}
public function & offsetGet($key): mixed {
$bar = $this->bar;
return $bar;
}
public function offsetSet($key, $val): void {
}
public function offsetUnset($key): void {
}
public function offsetExists($key): bool {
}
}
class bar { public $onBaz = []; }
$foo = new foo();
$foo->bar->onBaz[] = function() {};
var_dump($foo->bar->onBaz);
$foo = new foo();
$foo["bar"]->onBaz[] = function() {};
var_dump($foo->bar->onBaz);
?>
--EXPECTF--
array(1) {
[0]=>
object(Closure)#%d (0) {
}
}
array(1) {
[0]=>
object(Closure)#%d (0) {
}
}
Did this file decode correctly?
Original Code
--TEST--
bug #70321 (Magic getter breaks reference to array property)
--FILE--
<?php
class foo implements arrayAccess
{
private $bar;
public function __construct()
{
$this->bar = new bar();
}
public function & __get($key)
{
$bar = $this->bar;
return $bar;
}
public function & offsetGet($key): mixed {
$bar = $this->bar;
return $bar;
}
public function offsetSet($key, $val): void {
}
public function offsetUnset($key): void {
}
public function offsetExists($key): bool {
}
}
class bar { public $onBaz = []; }
$foo = new foo();
$foo->bar->onBaz[] = function() {};
var_dump($foo->bar->onBaz);
$foo = new foo();
$foo["bar"]->onBaz[] = function() {};
var_dump($foo->bar->onBaz);
?>
--EXPECTF--
array(1) {
[0]=>
object(Closure)#%d (0) {
}
}
array(1) {
[0]=>
object(Closure)#%d (0) {
}
}
Function Calls
None |
Stats
MD5 | 988ae331966ab7b9e646298929376740 |
Eval Count | 0 |
Decode Time | 109 ms |