diff --git a/NEWS b/NEWS index ca459617aafb5..8469bdc9df857 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ PHP NEWS - Core: . Fixed bug GH-17623 (Broken stack overflow detection for variable compilation). (ilutov) + . Fixed bug GH-17618 (UnhandledMatchError does not take + zend.exception_ignore_args=1 into account). (timwolla) - PHPDBG: . Partially fixed bug GH-17387 (Trivial crash in phpdbg lexer). (nielsdos) diff --git a/Zend/tests/match/049.phpt b/Zend/tests/match/049.phpt new file mode 100644 index 0000000000000..2a2385f704ff4 --- /dev/null +++ b/Zend/tests/match/049.phpt @@ -0,0 +1,42 @@ +--TEST-- +Match expression error messages (zend.exception_ignore_args=1) +--INI-- +zend.exception_ignore_args=1 +--FILE-- +getMessage() . PHP_EOL; + } +} + +test(null); +test(1); +test(5.5); +test(5.0); +test("foo"); +test(true); +test(false); +test([1, 2, 3]); +test(new Beep()); +// Testing long strings. +test(str_repeat('e', 100)); +test(str_repeat("e\n", 100)); +?> +--EXPECT-- +Unhandled match case of type null +Unhandled match case of type int +Unhandled match case of type float +Unhandled match case of type float +Unhandled match case of type string +Unhandled match case of type bool +Unhandled match case of type bool +Unhandled match case of type array +Unhandled match case of type Beep +Unhandled match case of type string +Unhandled match case of type string diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index bb3991f695f8b..dc28578f2c1a3 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -872,7 +872,7 @@ ZEND_COLD void zend_match_unhandled_error(const zval *value) { smart_str msg = {0}; - if (Z_TYPE_P(value) <= IS_STRING) { + if (!EG(exception_ignore_args) && Z_TYPE_P(value) <= IS_STRING) { smart_str_append_scalar(&msg, value, EG(exception_string_param_max_len)); } else { smart_str_appendl(&msg, "of type ", sizeof("of type ")-1);