Skip to content

func_num_args() answers the padded arity (2) through a first-class callable and __invoke; php answers the supplied count (1) #73

Closed

Description

@blacktrs

Summary

func_num_args() answers the padded arity (2) through a first-class callable and __invoke; php answers the supplied count (1).

Repro

<?php
// item: 9
class Q {
    function f($a, $b = 2) { return func_num_args(); }
    function __invoke($a, $b = 2) { return func_num_args(); }
}
$r = (new Q)->f(...);
echo $r(1), "\n";
$q = new Q;
echo $q(1), "\n";

Expected (php)

1
1

Actual (manticore 09cb49fb, Darwin arm64)

2
2

Tracking

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

Activity

  1. added
    bug
    wrong-answer
    on Oct 5, 2026
  2. added
    area:runtime
    on Oct 13, 2026
  3. blacktrs commented on Oct 13, 2026

    @blacktrs
    ContributorAuthor

    Partial (branch fix/batch-b). The __invoke half is FIXED (srcArgc set on the invoke reroutes). Still open: first-class-callable half — (new Q)->f(...) then $r(1) answers 2 (padded arity) instead of 1. The FCC shim needs a runtime-forwarded supplied-arg count. Keep open; repro stays XFAIL.

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

    area:runtimebugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions