Skip to content

Stdlib: ReflectionFunction::isVariadic() missing — ReflectionMethod works (ext/reflection/php_reflection.c, sibling #18228) #22045

Description

@PurHur

Category

Stdlib · php-src-strict · Reflection functions

Problem

ReflectionFunction::isVariadic() is undefined on the VM for a user function with ...$c, while ReflectionMethod::isVariadic() and ReflectionParameter::isVariadic() already match Zend. Sibling #18228 closed the method path; the free-function path was left behind (2026-07-22).

Repro Zend 8.2+ VM (2026-07-22)
function f($a, $b=1, ...$c){} → ReflectionFunction::isVariadic() true method missing
ReflectionMethod on m($a, ...$b) → isVariadic() true true (OK)
getNumberOfRequiredParameters() / getNumberOfParameters() 1 / 3 1 / 3 (OK)

php-src reference

PHP implementation target

  • ext/standard/VmReflection.php — implement isVariadic() on the ReflectionFunction / shared abstract path from function flag / last-param variadic bit
  • PHP-in-PHP only; no new C

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_reflection_function_is_variadic.php'
# compare: php test/repro/maintainer_gap_reflection_function_is_variadic.php

Done when

  • ReflectionFunction::isVariadic() matches Zend for variadic and non-variadic free functions (incl. closures if applicable)
  • Compliance .phpt under reflection/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 22, 2026
  2. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

    Pre-triage gates:

    Implementing ReflectionFunction::isVariadic() to match Zend (zim_reflection_function_abstract_isVariadic, sibling #18228).

  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged via #22079

    Verification: Zend/VM/JIT repro test/repro/maintainer_gap_reflection_function_is_variadic.php all print f_variadic=true g_variadic=false (plus closure/method/builtin cases); compliance reflection_function_is_variadic.phpt OK (2 tests); inventory 6343/6343; spine sidecar stamp synced.

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:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions