Skip to content

getDefaultValue() of a plain function's parameter throws "Failed to retrieve the default value" (methods work) #197

Closed

Description

@blacktrs

Summary

getDefaultValue() of a plain function's parameter throws "Failed to retrieve the default value" (methods work).

Repro

<?php
namespace N;
class K {}
function f(?K $b = null, string $c = 'x') {}
foreach ((new \ReflectionFunction('N\f'))->getParameters() as $p) {
    echo var_export($p->getDefaultValue(), true), "\n";
}

Expected (php)

NULL
'x'

Actual (manticore 2e174c5c, Darwin arm64)


[exit code 255]
PHP Fatal error:  Uncaught ReflectionException: Internal error: Failed to retrieve the default value

Tracking

Known-bug repro: tests/aot/repro/wrong/reflection_function_param_default_unavailable.php — bash tests/aot/xfail.sh -k reflection_function_param_default_unavailable reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions