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-- Test that ReflectionMethod::setAccessible() has no effects --FILE-- <?php class A..

Decoded Output download

--TEST--
Test that ReflectionMethod::setAccessible() has no effects
--FILE--
<?php
class A {
    private function aPrivate($a) { print __METHOD__ . "
"; }
    private static function aPrivateStatic($a) { print __METHOD__ . "
"; }
    protected function aProtected($a) { print __METHOD__ . "
"; }
    protected static function aProtectedStatic($a) { print __METHOD__ . "
"; }
}

$private         = new ReflectionMethod('A', 'aPrivate');
$privateStatic   = new ReflectionMethod('A', 'aPrivateStatic');
$protected       = new ReflectionMethod('A', 'aProtected');
$protectedStatic = new ReflectionMethod('A', 'aProtectedStatic');

$private->invoke(new A, NULL);
$private->invokeArgs(new A, array(NULL));
$privateStatic->invoke(NULL, NULL);
$privateStatic->invokeArgs(NULL, array(NULL));
$protected->invoke(new A, NULL);
$protected->invokeArgs(new A, array(NULL));
$protectedStatic->invoke(NULL, NULL);
$protectedStatic->invokeArgs(NULL, array(NULL));

$private->setAccessible(FALSE);
$privateStatic->setAccessible(FALSE);
$protected->setAccessible(FALSE);
$protectedStatic->setAccessible(FALSE);

$private->invoke(new A, NULL);
$private->invokeArgs(new A, array(NULL));
$privateStatic->invoke(NULL, NULL);
$privateStatic->invokeArgs(NULL, array(NULL));
$protected->invoke(new A, NULL);
$protected->invokeArgs(new A, array(NULL));
$protectedStatic->invoke(NULL, NULL);
$protectedStatic->invokeArgs(NULL, array(NULL));
?>
--EXPECT--
A::aPrivate
A::aPrivate
A::aPrivateStatic
A::aPrivateStatic
A::aProtected
A::aProtected
A::aProtectedStatic
A::aProtectedStatic
A::aPrivate
A::aPrivate
A::aPrivateStatic
A::aPrivateStatic
A::aProtected
A::aProtected
A::aProtectedStatic
A::aProtectedStatic

Did this file decode correctly?

Original Code

--TEST--
Test that ReflectionMethod::setAccessible() has no effects
--FILE--
<?php
class A {
    private function aPrivate($a) { print __METHOD__ . "\n"; }
    private static function aPrivateStatic($a) { print __METHOD__ . "\n"; }
    protected function aProtected($a) { print __METHOD__ . "\n"; }
    protected static function aProtectedStatic($a) { print __METHOD__ . "\n"; }
}

$private         = new ReflectionMethod('A', 'aPrivate');
$privateStatic   = new ReflectionMethod('A', 'aPrivateStatic');
$protected       = new ReflectionMethod('A', 'aProtected');
$protectedStatic = new ReflectionMethod('A', 'aProtectedStatic');

$private->invoke(new A, NULL);
$private->invokeArgs(new A, array(NULL));
$privateStatic->invoke(NULL, NULL);
$privateStatic->invokeArgs(NULL, array(NULL));
$protected->invoke(new A, NULL);
$protected->invokeArgs(new A, array(NULL));
$protectedStatic->invoke(NULL, NULL);
$protectedStatic->invokeArgs(NULL, array(NULL));

$private->setAccessible(FALSE);
$privateStatic->setAccessible(FALSE);
$protected->setAccessible(FALSE);
$protectedStatic->setAccessible(FALSE);

$private->invoke(new A, NULL);
$private->invokeArgs(new A, array(NULL));
$privateStatic->invoke(NULL, NULL);
$privateStatic->invokeArgs(NULL, array(NULL));
$protected->invoke(new A, NULL);
$protected->invokeArgs(new A, array(NULL));
$protectedStatic->invoke(NULL, NULL);
$protectedStatic->invokeArgs(NULL, array(NULL));
?>
--EXPECT--
A::aPrivate
A::aPrivate
A::aPrivateStatic
A::aPrivateStatic
A::aProtected
A::aProtected
A::aProtectedStatic
A::aProtectedStatic
A::aPrivate
A::aPrivate
A::aPrivateStatic
A::aPrivateStatic
A::aProtected
A::aProtected
A::aProtectedStatic
A::aProtectedStatic

Function Calls

None

Variables

None

Stats

MD5 63d960aa6c0dc396d3147cb1582846af
Eval Count 0
Decode Time 100 ms