<?php
foreach (['int' => 3, 'str' => 'secret-value', 'null' => null, 'true' => true, 'false' => false, 'arr' => [1]] as $label => $v) {
try { match ($v) { 0 => 0, 'nope' => 1 }; echo "$label:no\n"; }
catch (UnhandledMatchError $e) { echo $label, ':', $e->getMessage(), "\n"; }
}
Category
bug· php-src-strict · language matchProblem
#23664/#23678fixed UnhandledMatchError formatting, but variable subjects now always printNULLinstead of the Zend form. Literalfalsestill formats; afalsein a variable does not.Verified 2026-07-28 (host Zend 8.2.32 vs
bin/vm.php):match ($v)with$v = 3Unhandled match case 3Unhandled match case NULL$v = 'secret-value'Unhandled match case '...'Unhandled match case NULL$v = nullUnhandled match case NULLUnhandled match case NULL(OK)$v = trueUnhandled match case trueUnhandled match case NULL$v = falseUnhandled match case falseUnhandled match case NULL$v = [1]Unhandled match case of type arrayUnhandled match case NULLmatch(false)Unhandled match case falseUnhandled match case false(OK)php-src reference
Zend/zend_execute.c—zend_match_unhandled_error()Zend/zend_exceptions.c— match-case value formatting ('...'for strings;of type …for aggregates)PHP implementation target
lib/VM/MatchUnhandledSupport.php+ext/standard/phpc_match_unhandled_*.php/ match lowering inlib/Compiler.php— pass the live subject into the message helper (variable path currently loses the value); JIT/AOT agree when in scope; no newruntime/*.cRepro
Inline:
Done when
match(false)remains correct.phptguard undertest/compliance/cases/