Skip to content

Language: nested ?? (concat/call-arg) on uninitialized typed property aborts — Zend BP_VAR_IS default (re-#31146, zend_object_handlers.c) #31769

Description

@PurHur

Category

Language: · php-src-strict · nested ?? BP_VAR_IS

Problem

?? / ??= on an uninitialized typed property must use Zend BP_VAR_IS (quiet undefined → default), not a typed-property Error. Statement form $o->x ?? "d" already matches Zend (#31146). Nested forms — concat and function-arg — still compile/run as a normal read: VM prints the statement result then silently stops (exit 0, no Error, remaining echoes omitted). Same hole for static typed properties.

Probed 2026-08-17 — host Zend PHP 8.2 vs php bin/vm.php.

Repro Zend 8.2+ VM (2026-08-17)
var_export($o->x ?? "d"); (statement) 'd' then continues 'd' then continues
"concat=" . var_export($o->x ?? "d", true) concat='d' then after no further output (rc 0)
take($o->x ?? "d") arg=d then after empty (rc 0)
S::$y ?? "d" statement 'd' 'd'
concat of S::$y ?? "d" static_concat='d' then after no further output (rc 0)
class C { public int $x; }
$o = new C;
echo "stmt="; var_export($o->x ?? "d"); echo "\n";
echo "concat=" . var_export($o->x ?? "d", true) . "\n"; // Zend 'd' / VM aborts
echo "after\n";

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_uninit_typed_coalesce.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_uninit_typed_coalesce.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_uninit_static_coalesce.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_uninit_coalesce_arg.php'

Done when

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 / JITbugSomething 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