Skip to content

Commit 28a996b

Browse files
TimWollacharmitro
authored andcommitted
zend_execute: Suppress values in UnhandledMatchError for zend.exception_ignore_args=1 (php#17619)
Fixes php#17618.
1 parent 0443884 commit 28a996b

File tree

3 files changed

+155
-305
lines changed

3 files changed

+155
-305
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ PHP NEWS
88
- Core:
99
. Fixed bug GH-17623 (Broken stack overflow detection for variable
1010
compilation). (ilutov)
11+
. Fixed bug GH-17618 (UnhandledMatchError does not take
12+
zend.exception_ignore_args=1 into account). (timwolla)
1113

1214
- PHPDBG:
1315
. Partially fixed bug GH-17387 (Trivial crash in phpdbg lexer). (nielsdos)

Zend/tests/match/049.phpt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
Match expression error messages (zend.exception_ignore_args=1)
3+
--INI--
4+
zend.exception_ignore_args=1
5+
--FILE--
6+
<?php
7+
8+
class Beep {}
9+
10+
function test(mixed $var) {
11+
try {
12+
match($var) {};
13+
} catch (UnhandledMatchError $e) {
14+
print $e->getMessage() . PHP_EOL;
15+
}
16+
}
17+
18+
test(null);
19+
test(1);
20+
test(5.5);
21+
test(5.0);
22+
test("foo");
23+
test(true);
24+
test(false);
25+
test([1, 2, 3]);
26+
test(new Beep());
27+
// Testing long strings.
28+
test(str_repeat('e', 100));
29+
test(str_repeat("e\n", 100));
30+
?>
31+
--EXPECT--
32+
Unhandled match case of type null
33+
Unhandled match case of type int
34+
Unhandled match case of type float
35+
Unhandled match case of type float
36+
Unhandled match case of type string
37+
Unhandled match case of type bool
38+
Unhandled match case of type bool
39+
Unhandled match case of type array
40+
Unhandled match case of type Beep
41+
Unhandled match case of type string
42+
Unhandled match case of type string

0 commit comments

Comments
 (0)