mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: zend_execute: Suppress values in `UnhandledMatchError` for `zend.exception_ignore_args=1` (#17619)
This commit is contained in:
commit
7eaa9f0478
3 changed files with 48 additions and 1 deletions
2
NEWS
2
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)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug GH-17609 (Typo in error message: Dom\NO_DEFAULT_NS instead of
|
||||
|
|
42
Zend/tests/match/049.phpt
Normal file
42
Zend/tests/match/049.phpt
Normal file
|
@ -0,0 +1,42 @@
|
|||
--TEST--
|
||||
Match expression error messages (zend.exception_ignore_args=1)
|
||||
--INI--
|
||||
zend.exception_ignore_args=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Beep {}
|
||||
|
||||
function test(mixed $var) {
|
||||
try {
|
||||
match($var) {};
|
||||
} catch (UnhandledMatchError $e) {
|
||||
print $e->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
|
|
@ -875,7 +875,10 @@ ZEND_COLD zend_never_inline void zend_magic_get_property_type_inconsistency_erro
|
|||
ZEND_COLD void zend_match_unhandled_error(const zval *value)
|
||||
{
|
||||
smart_str msg = {0};
|
||||
if (smart_str_append_zval(&msg, value, EG(exception_string_param_max_len)) != SUCCESS) {
|
||||
if (
|
||||
EG(exception_ignore_args)
|
||||
|| smart_str_append_zval(&msg, value, EG(exception_string_param_max_len)) != SUCCESS
|
||||
) {
|
||||
smart_str_appendl(&msg, "of type ", sizeof("of type ")-1);
|
||||
smart_str_appends(&msg, zend_zval_type_name(value));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue