1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00
Files
archived-php-src/ext/reflection/tests/default_value_internal_userland_arginfo.phpt
T
Nikita Popov d033d5c07a Fix reflection getDefaultValue() with user arg info
The default value is part of the op_array in that case, but we have
no way to access it. Fail gracefully.
2020-11-12 11:02:04 +01:00

28 lines
615 B
PHP

--TEST--
Fetching default value of an internal trampoline function with userland arginfo
--FILE--
<?php
$closure = function ($b = 0) {};
$ro = new ReflectionObject($closure);
$rm = $ro->getMethod('__invoke');
echo $rm, "\n";
$rp = $rm->getParameters()[0];
var_dump($rp->isDefaultValueAvailable());
try {
var_dump($rp->getDefaultValue());
} catch (ReflectionException $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Method [ <internal> public method __invoke ] {
- Parameters [1] {
Parameter #0 [ <optional> $b = <default> ]
}
}
bool(false)
Internal error: Failed to retrieve the default value