xref: /PHP-8.0/Zend/tests/match/030.phpt (revision d5a03708)
1--TEST--
2Test string 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 %s030.php:4
20Stack trace:
21#0 %s030.php(7): {closure}(%d, 'Undefined varia...', '%s', %d)
22#1 {main}
23  thrown in %s030.php on line 4
24