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

Decoded Output download

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

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

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

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

foreach ($method->getParameters() as $parameter) {
    try {
        var_dump($parameter->isDefaultValueConstant());
    } catch (ReflectionException $exception) {
        echo $exception->getMessage() . "
";
    }
}
?>
--EXPECT--
Internal error: Failed to retrieve the default value
Internal error: Failed to retrieve the default value
bool(false)
bool(false)
----------
bool(true)
bool(false)

Did this file decode correctly?

Original Code

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

foreach ($method->getParameters() as $parameter) {
    try {
        var_dump($parameter->isDefaultValueConstant());
    } 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->isDefaultValueConstant());
    } catch (ReflectionException $exception) {
        echo $exception->getMessage() . "\n";
    }
}
?>
--EXPECT--
Internal error: Failed to retrieve the default value
Internal error: Failed to retrieve the default value
bool(false)
bool(false)
----------
bool(true)
bool(false)

Function Calls

None

Variables

None

Stats

MD5 ecbebc094b6dfcddc240c8d8869e4caf
Eval Count 0
Decode Time 71 ms