xref: /PHP-8.1/Zend/tests/match/029.phpt (revision d5a03708)
1--TEST--
2Test long match with undefined variable
3--FILE--
4<?php
5
6set_error_handler(function ($errno, $message) {
7    throw new Exception("Custom error handler: $message");
8});
9
10echo match ($undefVar) {
11   default => "This should not get printed with or without opcache\n",
12   1, 2, 3, 4, 5 => "Also should not be printed\n",
13};
14
15echo "unreachable\n";
16
17?>
18--EXPECTF--
19Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s029.php:4
20Stack trace:
21#0 %s029.php(7): {closure}(%d, 'Undefined varia...', '%s', %d)
22#1 {main}
23  thrown in %s029.php on line 4
24