Skip to content

Stdlib: ReflectionParameter::canBePassedByValue() true for by-ref params — Zend false (ext/reflection/php_reflection.c) #22145

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

ReflectionParameter::canBePassedByValue() must return false when the parameter is passed by reference (including variadic by-ref). php-compiler returns true for by-ref parameters even when isPassedByReference() is correctly true. (Method presence fixed in #18073; value semantics still wrong.)

Parameter Zend isPassedByReference / canBePassedByValue VM
&$a y / n y / y
$b n / y n / y
&...$c y / n y / y

php-src reference

PHP implementation target

  • ext/standard/VmReflection.php — canBePassedByValue := !isPassedByReference() (match Zend; confirm any ZEND_SEND_PREFER_REF edge if exposed)
  • PHP-in-PHP only

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_reflection_parameter_can_be_passed_by_value.php'

Done when

  • By-ref and by-ref-variadic parameters return canBePassedByValue() === false
  • By-value parameters remain true
  • Compliance .phpt guard
  • php-src-strict

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 Advanced — batch (issues #22127, #22108, #22145, #22064, #22144; sequential PRs)

    Queued: ReflectionParameter::canBePassedByValue() by-ref semantics.

  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — starting #22145 after #22108 merged (PR #22154).

    Fixing ReflectionParameter::canBePassedByValue() for by-ref params (php-src-strict).

  4. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    merged: #22156

    Verification

    • Zend + VM: by-ref params byValue=0, by-value byValue=1
    • phpunit filter can_be_passed_by_value + optional_api: OK (4 tests)

    Next in batch: #22064 hasType() for untyped params

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