xref: /php-src/Zend/tests/match/gh11134.phpt (revision 3a76f795)
1--TEST--
2GH-11134: Incorrect match optimization
3--FILE--
4<?php
5
6function testMatch() {
7    return match ($unset ?? null) {
8        'foo' => 'foo',
9        'bar' => 'bar',
10        default => 'baz',
11    };
12}
13
14function testSwitch() {
15    switch ($unset ?? null) {
16        case 'foo': return 'foo';
17        case 'bar': return 'bar';
18        default: return 'baz';
19    }
20}
21
22var_dump(testMatch());
23var_dump(testSwitch());
24
25?>
26--EXPECT--
27string(3) "baz"
28string(3) "baz"
29