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-- ReflectionParameter::getDefaultValue() should also work for parameters of interna..

Decoded Output download

--TEST--
ReflectionParameter::getDefaultValue() should also work for parameters of internal functions.
--FILE--
<?php
$class = new ReflectionClass('DateTime');
$method = $class->getMethod('setTime');

foreach ($method->getParameters() as $k => $parameter) {
    try {
        var_dump($parameter->getDefaultValue());
    } catch (ReflectionException $exception) {
        echo $exception->getMessage() . "
";
    }
}

echo "----------
";

$class = new ReflectionClass('DateTimeZone');
$method = $class->getMethod('listIdentifiers');

foreach ($method->getParameters() as $parameter) {
    try {
        var_dump($parameter->getDefaultValue());
    } catch (ReflectionException $exception) {
        echo $exception->getMessage() . "
";
    }
}

?>
--EXPECT--
Internal error: Failed to retrieve the default value
Internal error: Failed to retrieve the default value
int(0)
int(0)
----------
int(2047)
NULL

Did this file decode correctly?

Original Code

--TEST--
ReflectionParameter::getDefaultValue() should also work for parameters of internal functions.
--FILE--
<?php
$class = new ReflectionClass('DateTime');
$method = $class->getMethod('setTime');

foreach ($method->getParameters() as $k => $parameter) {
    try {
        var_dump($parameter->getDefaultValue());
    } catch (ReflectionException $exception) {
        echo $exception->getMessage() . "\n";
    }
}

echo "----------\n";

$class = new ReflectionClass('DateTimeZone');
$method = $class->getMethod('listIdentifiers');

foreach ($method->getParameters() as $parameter) {
    try {
        var_dump($parameter->getDefaultValue());
    } catch (ReflectionException $exception) {
        echo $exception->getMessage() . "\n";
    }
}

?>
--EXPECT--
Internal error: Failed to retrieve the default value
Internal error: Failed to retrieve the default value
int(0)
int(0)
----------
int(2047)
NULL

Function Calls

None

Variables

None

Stats

MD5 943b77c68739295f189ee625af27fe5a
Eval Count 0
Decode Time 87 ms