xref: /php-src/Zend/tests/match/029.phpt (revision 08b2ab22)
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 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', %d)
22#1 {main}
23  thrown in %s029.php on line 4
24