Skip to content

Language: echo/@$undef / arithmetic / call-arg still warn — Zend silences (re-#29132, zend_compile.c) #31881

Description

@PurHur

Category

Language · php-src-strict / error-control @ · residual of #29132 (Assign RHS is green)

Problem

@$undef as a value still emits Undefined variable on VM. Zend's ZEND_BEGIN_SILENCE suppresses the fetch. Assign RHS ($x = @$undef), bare @$undef;, and print @$undef are already silent (controls). Echo, binary ops, and call arguments are not.

Probed 2026-08-17 vs Zend 8.2.32 @ 8084f14996.

Repro Zend 8.2 VM
$x = @$undef (control, #29132) silent, NULL silent, NULL ✓
echo @$undef2 silent, NULL Warning: Undefined variable $undef2
@$undef3 + 1 silent, 1 warns then 1
strlen(@$undef4) only strlen(null) Deprecated Undefined variable and Deprecated
@$undef5; / print @$undef6 (control) silent silent ✓

php-src reference

PHP implementation target

  • lib/Compiler.php isErrorSuppressInnerExpr() — today includes Assign (Language: @$undef as assignment RHS still warns — Zend silences (ZEND_BEGIN_SILENCE) #29132) but not Echo_ / Print_ / binary ops / FuncCall arg fetches of a silenced CV
  • Ensure the CV fetch is compiled inside the silence region (same beginSilence/endSilence as Assign), not after ZEND_END_SILENCE
  • VM already honors ErrorReporter silence depth for undefined-variable — this is a lowering hole, not a new C path
  • No new runtime/*.c

Repro

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

Done when

  • echo @$undef / @$undef + 1 / strlen(@$undef) emit no Undefined variable Warning (match Zend)
  • strlen(@$undef) still emits the php-src Passing null to parameter #1 ($string) Deprecated (do not over-silence)
  • Assign / bare / print controls stay silent
  • Compliance .phpt or PHPUnit guard
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 17, 2026
  2. PurHur commented on Aug 17, 2026

    @PurHur
    OwnerAuthor

    claim: Worker lane A — starting this run

  3. PurHur commented on Aug 17, 2026

    @PurHur
    OwnerAuthor

    merged: #31897 (d7134a6625)

    Verification

    • Issue repro: Zend + php bin/vm.php + php bin/jit.php on test/repro/maintainer_gap_at_silence_undef.php — no Undefined variable; strlen(@$undef) still emits Passing null to parameter #1 ($string) Deprecated; assign/bare/print stay silent.
    • ./script/phpunit.sh --filter ErrorControlOperatorTest — OK (5 tests, 9 assertions)

    php-cfg now materializes @$cv as an Assign temp under silence and forwards that temp so echo/arithmetic/call-arg do not re-fetch the CV after END_SILENCE.

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