Skip to content

Regression: error_get_last() NULL after @ on bare undefined variable read — Zend still records (ext/standard/basic_functions.c) #13587

Description

@PurHur

Category

stdlib · php-src-strict

Problem

After @ suppresses an undefined variable read used as a statement (@$undefined;), Zend still records the warning in error_get_last(); VM returns null.

Assignment form @$x = $undefined does populate error_get_last() on VM — only the bare read statement is wrong.

php-src reference

Repro (verified 2026-06-29)

test/repro/maintainer_gap_error_get_last_at_read_stmt.php:

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_error_get_last_at_read_stmt.php; echo ---; php bin/vm.php test/repro/maintainer_gap_error_get_last_at_read_stmt.php'
Step Zend VM
@$undefined; then error_get_last() array with Undefined variable null ❌

Scope (PHP-in-PHP first)

Layer Path
VM lib/VM.php / error handler — record last error even when @ suppresses display for bare reads
Tests test/compliance/cases/stdlib/error_get_last_at_read_stmt.phpt

No new C runtime.

Done when (php-src-strict)

  • Repro prints ok on VM
  • @$x = $undefined and user/triggered warnings unchanged
  • ./script/ci-fast.sh --filter error_get_last_at_read green

Related

Activity

  1. added
    enhancementNew feature or request
    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 Jun 29, 2026
  2. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issues #13589, #13587)

  3. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    Merged via #13595. php-cfg patch emits UnaryPlus fetch for bare/@$var statement reads; error_get_last() now records Undefined variable under @. Verified: repro + vendor/bin/phpunit --filter error_get_last_at_read_stmt (2/2 green).

  4. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    Merged via #13601 — regenerated php-cfg-bare-variable-read-stmt.patch; repro php bin/vm.php test/repro/maintainer_gap_error_get_last_at_read_stmt.php prints ok.

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 machineenhancementNew feature or requestimplementation-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