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-- ReflectionClass::getConstants() with $filter --FILE-- <?php class A { public ..

Decoded Output download

--TEST--
ReflectionClass::getConstants() with $filter
--FILE--
<?php
class A {
    public const PUBLIC_CONST = 'BAR';
    public const ANOTHER_PUBLIC_CONST = 'BAZ';
    protected const PROTECTED_CONST = 'FOO';
    private const PRIVATE_CONST = 'QUOZ';
}

class B {
  public const PUBLIC_CONST = 'BAR';
  protected const ANOTHER_PROTECTED_CONST = 'BAZ';
  protected const PROTECTED_CONST = 'FOO';
  private const PRIVATE_CONST = 'QUOZ';
}

class C {
  public const PUBLIC_CONST = 'BAR';
  protected const PROTECTED_CONST = 'FOO';
  private const PRIVATE_CONST = 'QUOZ';
  private const ANOTHER_PRIVATE_CONST = 'BAZ';
}

$reflectionClassA = new ReflectionClass(A::class);
var_dump($reflectionClassA->getConstants(ReflectionClassConstant::IS_PUBLIC));

$reflectionClassB = new ReflectionClass(B::class);
var_dump($reflectionClassB->getConstants(ReflectionClassConstant::IS_PROTECTED));

$reflectionClassC = new ReflectionClass(C::class);
var_dump($reflectionClassC->getConstants(ReflectionClassConstant::IS_PRIVATE));
?>
--EXPECTF--
array(%d) {
  ["PUBLIC_CONST"]=>
  string(%d) "BAR"
  ["ANOTHER_PUBLIC_CONST"]=>
  string(%d) "BAZ"
}
array(%d) {
  ["ANOTHER_PROTECTED_CONST"]=>
  string(%d) "BAZ"
  ["PROTECTED_CONST"]=>
  string(%d) "FOO"
}
array(%d) {
  ["PRIVATE_CONST"]=>
  string(%d) "QUOZ"
  ["ANOTHER_PRIVATE_CONST"]=>
  string(%d) "BAZ"
}

Did this file decode correctly?

Original Code

--TEST--
ReflectionClass::getConstants() with $filter
--FILE--
<?php
class A {
    public const PUBLIC_CONST = 'BAR';
    public const ANOTHER_PUBLIC_CONST = 'BAZ';
    protected const PROTECTED_CONST = 'FOO';
    private const PRIVATE_CONST = 'QUOZ';
}

class B {
  public const PUBLIC_CONST = 'BAR';
  protected const ANOTHER_PROTECTED_CONST = 'BAZ';
  protected const PROTECTED_CONST = 'FOO';
  private const PRIVATE_CONST = 'QUOZ';
}

class C {
  public const PUBLIC_CONST = 'BAR';
  protected const PROTECTED_CONST = 'FOO';
  private const PRIVATE_CONST = 'QUOZ';
  private const ANOTHER_PRIVATE_CONST = 'BAZ';
}

$reflectionClassA = new ReflectionClass(A::class);
var_dump($reflectionClassA->getConstants(ReflectionClassConstant::IS_PUBLIC));

$reflectionClassB = new ReflectionClass(B::class);
var_dump($reflectionClassB->getConstants(ReflectionClassConstant::IS_PROTECTED));

$reflectionClassC = new ReflectionClass(C::class);
var_dump($reflectionClassC->getConstants(ReflectionClassConstant::IS_PRIVATE));
?>
--EXPECTF--
array(%d) {
  ["PUBLIC_CONST"]=>
  string(%d) "BAR"
  ["ANOTHER_PUBLIC_CONST"]=>
  string(%d) "BAZ"
}
array(%d) {
  ["ANOTHER_PROTECTED_CONST"]=>
  string(%d) "BAZ"
  ["PROTECTED_CONST"]=>
  string(%d) "FOO"
}
array(%d) {
  ["PRIVATE_CONST"]=>
  string(%d) "QUOZ"
  ["ANOTHER_PRIVATE_CONST"]=>
  string(%d) "BAZ"
}

Function Calls

None

Variables

None

Stats

MD5 8856f3c36109b66630d9f6c2e95bfd7b
Eval Count 0
Decode Time 89 ms