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-- SPL: Ensure access to non-visible properties falls back to dimension access with ..
Decoded Output download
--TEST--
SPL: Ensure access to non-visible properties falls back to dimension access with ArrayObject::ARRAY_AS_PROPS.
--FILE--
<?php
class C extends ArrayObject {
private $x = 'secret';
static function go($c) {
var_dump($c->x);
}
}
$c = new C(array('x'=>'public'));
$c->setFlags(ArrayObject::ARRAY_AS_PROPS);
C::go($c);
var_dump($c->x);
$c->setFlags(0);
C::go($c);
var_dump($c->x);
?>
--EXPECTF--
string(6) "secret"
string(6) "public"
string(6) "secret"
Fatal error: Uncaught Error: Cannot access private property C::$x in %s:19
Stack trace:
#0 {main}
thrown in %s on line 19
Did this file decode correctly?
Original Code
--TEST--
SPL: Ensure access to non-visible properties falls back to dimension access with ArrayObject::ARRAY_AS_PROPS.
--FILE--
<?php
class C extends ArrayObject {
private $x = 'secret';
static function go($c) {
var_dump($c->x);
}
}
$c = new C(array('x'=>'public'));
$c->setFlags(ArrayObject::ARRAY_AS_PROPS);
C::go($c);
var_dump($c->x);
$c->setFlags(0);
C::go($c);
var_dump($c->x);
?>
--EXPECTF--
string(6) "secret"
string(6) "public"
string(6) "secret"
Fatal error: Uncaught Error: Cannot access private property C::$x in %s:19
Stack trace:
#0 {main}
thrown in %s on line 19
Function Calls
None |
Stats
MD5 | 900b79582f5653557b9fa24ae909afe7 |
Eval Count | 0 |
Decode Time | 82 ms |