Regression: error_get_last() NULL after @ on bare undefined variable read — Zend still records (ext/standard/basic_functions.c) #13587
Copy link
Copy link
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsstdlib
Description
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
ext/standard/basic_functions.c—PHP_FUNCTION(error_get_last)Zend/zend.c— error recording independent of@display
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
okon VM -
@$x = $undefinedand user/triggered warnings unchanged -
./script/ci-fast.sh --filter error_get_last_at_readgreen
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsstdlib
Activity
PurHur commentedon Jun 29, 2026
claim: PHP Runtime → PHP — batch (issues #13589, #13587)
Emit bare variable reads in CFG so error_get_last records @ warnings (#…
PurHur commentedon Jun 29, 2026
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).Fix bare @ variable read patch + vsprintf JIT TypeError guard (#13587, …
PurHur commentedon Jun 29, 2026
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.phpprints ok.