Skip to content

Language: nullsafe ?-> method call with inline arg — compile TypeError in Compiler.php (Zend/zend_compile.c) #17186

Description

@PurHur

Category

language · php-src-strict · compiler lowering

Problem

Nullsafe method calls with inline expression arguments (e.g. IIFE) fail at compile time instead of short-circuiting on a null receiver. Zend compiles and runs correctly; VM fatals in outerSiblingInlineCallArgProducerSlot() because compileNullsafeMethodCall() omits the CFG call op when lowering argument sends.

Repro Zend 8.2+ VM (2026-07-07)
$c?->f((function(){ return 1; })()) with $c = null NULL (arg not evaluated) TypeError in Compiler.php:36609

php-src reference

PHP implementation target

  • lib/Compiler.phpcompileNullsafeMethodCall() must pass $expr as $cfgCallOp to compileCallArgSends() (mirror compileMethodCallOpcodes)

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter nullsafe_method_args_short_circuit'

Done when

  • Compliance test/compliance/cases/language/nullsafe_method_args_short_circuit.phpt passes VM
  • test/repro-maintainer/nullsafe_method_args.php matches Zend
  • php-src-strict; no php-compiler-strict shortcut

Activity

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:compilerCompiler / CFG / JITarea:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions