From 5ccc3b1db9d02e17b971e1563e98394c06dd4d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 28 Feb 2024 09:16:12 +0100 Subject: [PATCH 01/13] Include the source location in Closure names This change makes stack traces involving Closures, especially multiple different Closures, much more useful, because it's more easily visible *which* closure was called for a given stack frame. The implementation is similar to that of anonymous classes which already include the file name and line number within their generated classname. --- Zend/tests/closure_064.phpt | 32 ++++++++++++++++++++++++++++++++ Zend/tests/closure_065.phpt | 16 ++++++++++++++++ Zend/zend_closures.c | 3 +++ Zend/zend_compile.c | 12 +++++++++++- Zend/zend_language_parser.y | 4 ++-- 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 Zend/tests/closure_064.phpt create mode 100644 Zend/tests/closure_065.phpt diff --git a/Zend/tests/closure_064.phpt b/Zend/tests/closure_064.phpt new file mode 100644 index 0000000000000..6d234accd985f --- /dev/null +++ b/Zend/tests/closure_064.phpt @@ -0,0 +1,32 @@ +--TEST-- +The closure name includes the source location +--FILE-- + $closure1(); +$closure3 = get_closure3($closure2); +\array_map( + function ($item) use ($closure3) { $closure3(); }, + [1] +); +?> +--EXPECTF-- +Fatal error: Uncaught Exception in %s:8 +Stack trace: +#0 %s(11): throws() +#1 %s(12): {closure:%s:11}() +#2 %s(4): {closure:%s:12}() +#3 %s(15): {closure:%s:3}() +#4 [internal function]: {closure:%s:15}(1) +#5 %s(14): array_map(Object(Closure), Array) +#6 {main} + thrown in %s on line 8 diff --git a/Zend/tests/closure_065.phpt b/Zend/tests/closure_065.phpt new file mode 100644 index 0000000000000..35e9213b2eddc --- /dev/null +++ b/Zend/tests/closure_065.phpt @@ -0,0 +1,16 @@ +--TEST-- +Dumping closures includes the name. +--FILE-- + +--EXPECTF-- +object(Closure)#1 (2) { + ["name"]=> + string(70) "{closure:%s:2}" + ["parameter"]=> + array(1) { + ["$foo"]=> + string(10) "" + } +} diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6f08a7ca49a83..c805818a165c1 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -603,6 +603,9 @@ static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) ZVAL_STR_COPY(&val, closure->func.common.function_name); } zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_FUNCTION), &val); + } else { + ZVAL_STR_COPY(&val, closure->func.common.function_name); + zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_NAME), &val); } if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b52fffec787f2..af541e6b4f430 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7665,7 +7665,14 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_string *unqualified_name, *name, *lcname; zend_op *opline; - unqualified_name = decl->name; + if (op_array->fn_flags & ZEND_ACC_CLOSURE) { + zend_string *filename = op_array->filename; + uint32_t start_lineno = decl->start_lineno; + unqualified_name = zend_strpprintf(0, "{closure:%s:%" PRIu32 "}", ZSTR_VAL(filename), start_lineno); + } else { + unqualified_name = zend_string_copy(decl->name); + } + op_array->function_name = name = zend_prefix_with_ns(unqualified_name); lcname = zend_string_tolower(name); @@ -7703,6 +7710,9 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, opline->op2.num = func_ref; } } + + zend_string_release(unqualified_name); + return lcname; } /* }}} */ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 298eaf95ad055..6e882f922f374 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -1263,12 +1263,12 @@ inline_function: function returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars return_type backup_fn_flags '{' inner_statement_list '}' backup_fn_flags { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2 | $13, $1, $3, - ZSTR_INIT_LITERAL("{closure}", 0), + NULL, $5, $7, $11, $8, NULL); CG(extra_fn_flags) = $9; } | fn returns_ref backup_doc_comment '(' parameter_list ')' return_type T_DOUBLE_ARROW backup_fn_flags backup_lex_pos expr backup_fn_flags { $$ = zend_ast_create_decl(ZEND_AST_ARROW_FUNC, $2 | $12, $1, $3, - ZSTR_INIT_LITERAL("{closure}", 0), $5, NULL, $11, $7, NULL); + NULL, $5, NULL, $11, $7, NULL); CG(extra_fn_flags) = $9; } ; From e07ee9df10f5af9519a717e1cc99372f0aef1e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 28 Feb 2024 09:25:20 +0100 Subject: [PATCH 02/13] Update scripts/dev/bless_tests.php for closure naming --- scripts/dev/bless_tests.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/dev/bless_tests.php b/scripts/dev/bless_tests.php index fa49647fcf480..baf07d61f9e51 100755 --- a/scripts/dev/bless_tests.php +++ b/scripts/dev/bless_tests.php @@ -62,8 +62,10 @@ function getFiles(array $dirsOrFiles): \Iterator { } function normalizeOutput(string $out): string { - $out = preg_replace('/in (\/|[A-Z]:\\\\).+ on line \d+$/m', 'in %s on line %d', $out); + $out = preg_replace('/in (\/|[A-Z]:\\\\).+ on line \d+/m', 'in %s on line %d', $out); $out = preg_replace('/in (\/|[A-Z]:\\\\).+:\d+$/m', 'in %s:%d', $out); + $out = preg_replace('/\{closure:(\/|[A-Z]:\\\\).+:\d+\}/', '{closure:%s:%d}', $out); + $out = preg_replace('/object\(([A-Za-z0-9]*)\)#\d+/', 'object($1)#%d', $out); $out = preg_replace('/^#(\d+) (\/|[A-Z]:\\\\).+\(\d+\):/m', '#$1 %s(%d):', $out); $out = preg_replace('/Resource id #\d+/', 'Resource id #%d', $out); $out = preg_replace('/resource\(\d+\) of type/', 'resource(%d) of type', $out); From a46010064afa471c2d304517250a7b2643b9655a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 28 Feb 2024 09:31:14 +0100 Subject: [PATCH 03/13] Adjust existing tests for closure naming --- Zend/tests/arrow_functions/006.phpt | 4 +- Zend/tests/bug26697.phpt | 6 +- Zend/tests/bug31102.phpt | 8 +- Zend/tests/bug49908.phpt | 4 +- Zend/tests/bug52193.phpt | 28 ++- Zend/tests/bug60738.phpt | 4 +- Zend/tests/bug60738_variation.phpt | 4 +- Zend/tests/bug60909_1.phpt | 2 +- Zend/tests/bug61273.phpt | 2 +- Zend/tests/bug61767.phpt | 8 +- Zend/tests/bug64960.phpt | 2 +- Zend/tests/bug67856.phpt | 12 +- Zend/tests/bug70321.phpt | 8 +- Zend/tests/bug72101.phpt | 2 +- Zend/tests/bug74164.phpt | 4 +- Zend/tests/bug75079_2.phpt | 2 +- Zend/tests/bug75290.phpt | 8 +- Zend/tests/bug76534.phpt | 2 +- Zend/tests/bug79657.phpt | 2 +- Zend/tests/bug79778.phpt | 17 +- Zend/tests/bug81076.phpt | 6 +- Zend/tests/call_user_func_003.phpt | 8 +- Zend/tests/call_user_func_005.phpt | 4 +- Zend/tests/closure_005.phpt | 2 +- Zend/tests/closure_019.phpt | 2 +- Zend/tests/closure_020.phpt | 4 +- Zend/tests/closure_026.phpt | 8 +- Zend/tests/closure_027.phpt | 2 +- Zend/tests/closure_032.phpt | 9 +- Zend/tests/closure_033.phpt | 2 +- Zend/tests/closure_034.phpt | 4 +- Zend/tests/closure_035.phpt | 4 +- Zend/tests/closure_038.phpt | 2 +- Zend/tests/closure_039.phpt | 2 +- Zend/tests/closure_059.phpt | 6 +- ...ation_to_exception_during_inheritance.phpt | 2 +- Zend/tests/exception_023.phpt | 2 +- .../exception_during_variance_autoload.phpt | 2 +- .../exception_during_variance_autoload_2.phpt | 2 +- Zend/tests/exception_ignore_args.phpt | 2 +- Zend/tests/fibers/backtrace-deep-nesting.phpt | 2 +- Zend/tests/fibers/backtrace-nested.phpt | 2 +- Zend/tests/fibers/debug-backtrace.phpt | 2 +- Zend/tests/fibers/failing-fiber.phpt | 2 +- Zend/tests/fibers/failing-nested-fiber.phpt | 4 +- .../fibers/get-return-after-bailout.phpt | 2 +- .../fibers/no-switch-force-close-finally.phpt | 2 +- Zend/tests/fibers/no-switch-gc.phpt | 2 +- Zend/tests/fibers/resume-previous-fiber.phpt | 4 +- Zend/tests/fibers/resume-running-fiber.phpt | 2 +- Zend/tests/fibers/start-arguments.phpt | 4 +- ...d-in-force-close-fiber-after-shutdown.phpt | 2 +- .../fibers/suspend-in-force-close-fiber.phpt | 2 +- .../fibers/throw-during-fiber-destruct.phpt | 2 +- ...tiple-destroyed-fibers-after-shutdown.phpt | 4 +- Zend/tests/fibers/ticks.phpt | 4 +- .../call_with_trailing_comma_basic.phpt | 4 +- .../sensitive_parameter_arrow_function.phpt | 2 +- .../sensitive_parameter_closure.phpt | 6 +- Zend/tests/generators/gh11028_2.phpt | 2 +- Zend/tests/gh10695_4.phpt | 2 +- Zend/tests/gh8810_3.phpt | 2 +- Zend/tests/gh8841.phpt | 2 +- Zend/tests/gh9916-009.phpt | 4 +- Zend/tests/match/029.phpt | 2 +- Zend/tests/match/030.phpt | 2 +- Zend/tests/named_params/call_user_func.phpt | 4 +- Zend/tests/nested_method_and_function.phpt | 6 +- Zend/tests/return_types/011.phpt | 2 + Zend/tests/return_types/012.phpt | 8 +- Zend/tests/return_types/013.phpt | 4 +- .../tests/type_declarations/callable_001.phpt | 4 +- .../tests/type_declarations/scalar_basic.phpt | 52 +++--- Zend/tests/type_declarations/scalar_none.phpt | 8 +- Zend/tests/type_declarations/scalar_null.phpt | 8 +- .../scalar_return_basic_64bit.phpt | 52 +++--- .../scalar_strict_64bit.phpt | 102 +++++------ .../scalar_strict_basic.phpt | 60 +++---- .../type_declarations/static_type_return.phpt | 18 +- .../typed_properties_055.phpt | 2 +- .../union_types/type_checking_strict.phpt | 170 +++++++++--------- .../union_types/type_checking_weak.phpt | 78 ++++---- .../variance/loading_exception1.phpt | 2 +- .../variance/loading_exception2.phpt | 2 +- Zend/tests/undef_var_in_verify_return.phpt | 2 +- Zend/tests/use_unlinked_class.phpt | 2 +- ext/opcache/tests/jit/assign_055.phpt | 4 +- ext/opcache/tests/jit/fetch_dim_rw_004.phpt | 4 +- ext/opcache/tests/jit/fetch_obj_006.phpt | 2 +- ext/opcache/tests/jit/not_003.phpt | 4 +- ext/reflection/tests/007.phpt | 2 +- .../tests/ReflectionFiber_basic.phpt | 4 +- .../tests/ReflectionFiber_bug_gh11121_1.phpt | 2 +- .../tests/ReflectionFiber_bug_gh11121_2.phpt | 2 +- .../tests/ReflectionFiber_notrace_2.phpt | 2 +- .../tests/ReflectionGenerator_basic.phpt | 4 +- .../ReflectionGenerator_in_Generator.phpt | 10 +- ext/reflection/tests/bug80299.phpt | 2 +- ext/reflection/tests/closures_003_v1.phpt | 6 +- ext/spl/tests/bug71236.phpt | 6 +- ext/spl/tests/bug72051.phpt | 2 +- ext/spl/tests/spl_autoload_013.phpt | 4 +- .../tests/array/array_map_variation10.phpt | 4 +- .../tests/array/array_walk_closure.phpt | 18 +- ext/standard/tests/array/bug52719.phpt | 4 +- .../tests/array/uasort_variation7.phpt | 16 +- .../tests/array/usort_variation7.phpt | 16 +- ext/standard/tests/serialize/bug30234.phpt | 4 +- ext/zend_test/tests/gh10695_2.phpt | 2 +- .../tests/observer_backtrace_01.phpt | 14 +- ext/zend_test/tests/observer_closure_01.phpt | 28 +-- ext/zend_test/tests/observer_error_05.phpt | 6 +- ext/zend_test/tests/observer_fiber_01.phpt | 2 +- ext/zend_test/tests/observer_fiber_02.phpt | 2 +- ext/zend_test/tests/observer_fiber_03.phpt | 4 +- ext/zend_test/tests/observer_fiber_04.phpt | 4 +- ext/zend_test/tests/observer_fiber_05.phpt | 4 +- ext/zend_test/tests/observer_fiber_06.phpt | 2 +- .../tests/observer_fiber_functions_01.phpt | 8 +- .../tests/observer_fiber_functions_02.phpt | 8 +- .../tests/observer_fiber_functions_03.phpt | 12 +- ext/zend_test/tests/observer_shutdown_01.phpt | 6 +- sapi/phpdbg/tests/exceptions_001.phpt | 4 +- sapi/phpdbg/tests/exceptions_002.phpt | 4 +- 124 files changed, 580 insertions(+), 512 deletions(-) diff --git a/Zend/tests/arrow_functions/006.phpt b/Zend/tests/arrow_functions/006.phpt index 8079c9c491e4e..6f61b3c817d9e 100644 --- a/Zend/tests/arrow_functions/006.phpt +++ b/Zend/tests/arrow_functions/006.phpt @@ -32,7 +32,7 @@ try { --EXPECTF-- int(2) int(10) -{closure}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d +{closure:%s:%d}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d array(3) { [0]=> int(20) @@ -41,4 +41,4 @@ array(3) { [2]=> int(30) } -{closure}(): Argument #2 must be of type ?int, string given, called in %s on line %d +{closure:%s:%d}(): Argument #2 must be of type ?int, string given, called in %s on line %d diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt index d5e3592764bc0..b9d46cc8d90b1 100644 --- a/Zend/tests/bug26697.phpt +++ b/Zend/tests/bug26697.phpt @@ -12,8 +12,8 @@ spl_autoload_register(function ($name) { var_dump(class_exists('NotExistingClass')); ?> ---EXPECT-- -{closure}(NotExistingClass) +--EXPECTF-- +{closure:%s:%d}(NotExistingClass) bool(false) -{closure}(NotExistingClass), done +{closure:%s:%d}(NotExistingClass), done bool(false) diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt index 3f25aa00e0724..17beec6ba389c 100644 --- a/Zend/tests/bug31102.phpt +++ b/Zend/tests/bug31102.phpt @@ -37,11 +37,11 @@ while($test++ < 5) ?> ===DONE=== --EXPECTF-- -{closure}(Test1,1) +{closure:%s:%d}(Test1,1) Caught: Test1::__construct -{closure}(Test2,2) -Caught: {closure} -{closure}(Test3,3) +{closure:%s:%d}(Test2,2) +Caught: {closure:%s:%d} +{closure:%s:%d}(Test3,3) Fatal error: Uncaught Error: Class "Test3" not found in %s:%d Stack trace: diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt index e545a0858cab6..5c484e26a90f4 100644 --- a/Zend/tests/bug49908.phpt +++ b/Zend/tests/bug49908.phpt @@ -29,7 +29,7 @@ string(3) "Bar" Fatal error: Uncaught Exception: Bar in %s:%d Stack trace: -#0 %s(%d): {closure}('Bar') -#1 %s(%d): {closure}('Foo') +#0 %s(%d): {closure:%s:%d}('Bar') +#1 %s(%d): {closure:%s:%d}('Foo') #2 {main} thrown in %s on line %d diff --git a/Zend/tests/bug52193.phpt b/Zend/tests/bug52193.phpt index 12b9868bcc0dd..42c379151d036 100644 --- a/Zend/tests/bug52193.phpt +++ b/Zend/tests/bug52193.phpt @@ -35,43 +35,57 @@ array(0) { } array(1) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } int(2) array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["h"]=> &array(1) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } } } } -object(Closure)#%d (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["h"]=> &array(1) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } } } array(1) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } array(2) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } [1]=> int(5) diff --git a/Zend/tests/bug60738.phpt b/Zend/tests/bug60738.phpt index e4080715ec72a..662b335078b6c 100644 --- a/Zend/tests/bug60738.phpt +++ b/Zend/tests/bug60738.phpt @@ -16,7 +16,9 @@ trigger_error('Error!'); --EXPECTF-- NULL Intercepted error! -object(Closure)#1 (0) { +object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } Notice: Error! in %s on line %d diff --git a/Zend/tests/bug60738_variation.phpt b/Zend/tests/bug60738_variation.phpt index cf2ea607a08fb..519d44f99d915 100644 --- a/Zend/tests/bug60738_variation.phpt +++ b/Zend/tests/bug60738_variation.phpt @@ -13,7 +13,9 @@ throw new Exception('Exception!'); ?> --EXPECTF-- NULL -object(Closure)#1 (0) { +object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } Fatal error: Uncaught Exception: Exception! in %s:%d diff --git a/Zend/tests/bug60909_1.phpt b/Zend/tests/bug60909_1.phpt index 73b451802d1d5..4404adfd54a3b 100644 --- a/Zend/tests/bug60909_1.phpt +++ b/Zend/tests/bug60909_1.phpt @@ -14,7 +14,7 @@ require 'notfound.php'; error(require(notfound.php): Failed to open stream: %s) Fatal error: Uncaught Exception: Foo in %sbug60909_1.php:5 Stack trace: -#0 %sbug60909_1.php(8): {closure}(2, 'require(notfoun...', '%s', 8) +#0 %s(%d): {closure:%s:%d}(2, 'require(notfoun...', '%s', 8) #1 %sbug60909_1.php(8): require() #2 {main} thrown in %sbug60909_1.php on line 5 diff --git a/Zend/tests/bug61273.phpt b/Zend/tests/bug61273.phpt index 92ad2c9918f52..ea3930d04f911 100644 --- a/Zend/tests/bug61273.phpt +++ b/Zend/tests/bug61273.phpt @@ -12,5 +12,5 @@ call_user_func_array(function(&$a) {}, $args); echo strval("okey"); ?> --EXPECTF-- -Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d okey diff --git a/Zend/tests/bug61767.phpt b/Zend/tests/bug61767.phpt index f47eb0cbe82c4..a12c5716e9aee 100644 --- a/Zend/tests/bug61767.phpt +++ b/Zend/tests/bug61767.phpt @@ -20,14 +20,18 @@ Error handler called (Undefined variable $undefined) Fatal error: Uncaught ErrorException: Undefined variable $undefined in %sbug61767.php:%d Stack trace: -#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 13) #1 {main} thrown in %sbug61767.php on line %d Shutting down Array ( [type] => 1 - [message] => %a + [message] => Uncaught ErrorException: Undefined variable $undefined in %s:%d +Stack trace: +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 13) +#1 {main} + thrown [file] => %sbug61767.php [line] => %d ) diff --git a/Zend/tests/bug64960.phpt b/Zend/tests/bug64960.phpt index 6ed010c859abf..d3dcc4da8c5e6 100644 --- a/Zend/tests/bug64960.phpt +++ b/Zend/tests/bug64960.phpt @@ -37,7 +37,7 @@ Deprecated: Creation of dynamic property Exception::$_trace is deprecated in %s Fatal error: Uncaught Exception in %sbug64960.php:19 Stack trace: -#0 [internal function]: {closure}(8, 'ob_end_clean():...', '%s', 9) +#0 [internal function]: {closure:%s:%d}(8, 'ob_end_clean():...', '%s', 9) #1 %sbug64960.php(9): ob_end_clean() #2 [internal function]: ExceptionHandler->__invoke(Object(Exception)) #3 {main} diff --git a/Zend/tests/bug67856.phpt b/Zend/tests/bug67856.phpt index b88df39341a27..7cf1d1ae061ed 100644 --- a/Zend/tests/bug67856.phpt +++ b/Zend/tests/bug67856.phpt @@ -8,15 +8,15 @@ var_dump(array_reduce($array, function(&$a, &$b) { }, 0)); ?> --EXPECTF-- -Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d int(6) diff --git a/Zend/tests/bug70321.phpt b/Zend/tests/bug70321.phpt index def8da5a43a69..bddfc9129e9fc 100644 --- a/Zend/tests/bug70321.phpt +++ b/Zend/tests/bug70321.phpt @@ -39,11 +39,15 @@ var_dump($foo->bar->onBaz); --EXPECTF-- array(1) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } array(1) { [0]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } diff --git a/Zend/tests/bug72101.phpt b/Zend/tests/bug72101.phpt index f205526f0923f..6362a7ccb303b 100644 --- a/Zend/tests/bug72101.phpt +++ b/Zend/tests/bug72101.phpt @@ -78,7 +78,7 @@ $foo->bar($a, $b, $c); --EXPECTF-- Fatal error: Uncaught Error: Class "DoesNotExists" not found in %s:%d Stack trace: -#0 %sbug72101.php(%d): {closure}(2, 'MethodCallbackB...', '%s', 8) +#0 %s(%d): {closure:%s:%d}(2, 'MethodCallbackB...', '%s', 8) #1 %sbug72101.php(%d): PHPUnit_Framework_MockObject_Stub_ReturnCallback->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static)) #2 %sbug72101.php(%d): PHPUnit_Framework_MockObject_Matcher->invoked(Object(PHPUnit_Framework_MockObject_Invocation_Static)) #3 %sbug72101.php(%d): PHPUnit_Framework_MockObject_InvocationMocker->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static)) diff --git a/Zend/tests/bug74164.phpt b/Zend/tests/bug74164.phpt index 36d681290d12d..e0b8a014107be 100644 --- a/Zend/tests/bug74164.phpt +++ b/Zend/tests/bug74164.phpt @@ -12,9 +12,9 @@ set_error_handler(function ($type, $msg) { call_user_func(function (array &$ref) {var_dump("xxx");}, 'not_an_array_variable'); ?> --EXPECTF-- -Fatal error: Uncaught Exception: Foo\{closure}(): Argument #1 ($ref) must be passed by reference, value given in %s:%d +Fatal error: Uncaught Exception: Foo\{closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s:%d Stack trace: -#0 [internal function]: Foo\{closure}(%s) +#0 [internal function]: Foo\{closure:%s:%d}(2, '%s', '%s', 9) #1 %sbug74164.php(%d): call_user_func(%s) #2 {main} thrown in %sbug74164.php on line %d diff --git a/Zend/tests/bug75079_2.phpt b/Zend/tests/bug75079_2.phpt index 92518555b459d..8e0fe481621ae 100644 --- a/Zend/tests/bug75079_2.phpt +++ b/Zend/tests/bug75079_2.phpt @@ -31,6 +31,6 @@ int(123) Fatal error: Uncaught Error: Cannot access private property Foo::$bar in %s:%d Stack trace: -#0 %s(%d): A->{closure}() +#0 %s(%d): A->{closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/bug75290.phpt b/Zend/tests/bug75290.phpt index 948a56e172a14..2a23a8af30ccf 100644 --- a/Zend/tests/bug75290.phpt +++ b/Zend/tests/bug75290.phpt @@ -8,8 +8,8 @@ var_dump((new ReflectionFunction('sin'))->getClosure()); var_dump(function ($someThing) {}); ?> ---EXPECT-- -object(Closure)#2 (2) { +--EXPECTF-- +object(Closure)#%d (2) { ["function"]=> string(3) "sin" ["parameter"]=> @@ -18,7 +18,9 @@ object(Closure)#2 (2) { string(10) "" } } -object(Closure)#2 (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["parameter"]=> array(1) { ["$someThing"]=> diff --git a/Zend/tests/bug76534.phpt b/Zend/tests/bug76534.phpt index f544d964c4140..c9c897110d6cd 100644 --- a/Zend/tests/bug76534.phpt +++ b/Zend/tests/bug76534.phpt @@ -12,6 +12,6 @@ $y = &$x["2bar"]; --EXPECTF-- Fatal error: Uncaught Exception: Illegal string offset "2bar" in %s:%d Stack trace: -#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d) +#0 %s(%d): {closure:%s:%d}(2, 'Illegal string ...', '%s', 7) #1 {main} thrown in %sbug76534.php on line %d diff --git a/Zend/tests/bug79657.phpt b/Zend/tests/bug79657.phpt index fb2ccab3e3ef3..f0c93534edb36 100644 --- a/Zend/tests/bug79657.phpt +++ b/Zend/tests/bug79657.phpt @@ -36,7 +36,7 @@ get(...loop()); Fatal error: Uncaught Exception in %s:%d Stack trace: #0 %s(%d): throwException() -#1 %s(%d): {closure}() +#1 %s(%d): {closure:%s:%d}() #2 %s(%d): loop() #3 {main} thrown in %s on line %d diff --git a/Zend/tests/bug79778.phpt b/Zend/tests/bug79778.phpt index 44c9027372767..09bc5d3276d3f 100644 --- a/Zend/tests/bug79778.phpt +++ b/Zend/tests/bug79778.phpt @@ -24,8 +24,10 @@ var_dump($closure1); print_r($closure1); ?> ---EXPECT-- -object(Closure)#1 (1) { +--EXPECTF-- +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["var"]=> @@ -34,6 +36,7 @@ object(Closure)#1 (1) { } Closure Object ( + [name] => {closure:%s:%d} [static] => Array ( [var] => @@ -41,7 +44,9 @@ Closure Object ) Undefined constant "CONST_REF" -object(Closure)#1 (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["var"]=> @@ -50,13 +55,16 @@ object(Closure)#1 (1) { } Closure Object ( + [name] => {closure:%s:%d} [static] => Array ( [var] => ) ) -object(Closure)#1 (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["var"]=> @@ -65,6 +73,7 @@ object(Closure)#1 (1) { } Closure Object ( + [name] => {closure:%s:%d} [static] => Array ( [var] => foo diff --git a/Zend/tests/bug81076.phpt b/Zend/tests/bug81076.phpt index 27d5d8d10f1e4..9bb7d48d39624 100644 --- a/Zend/tests/bug81076.phpt +++ b/Zend/tests/bug81076.phpt @@ -4,6 +4,8 @@ Bug #81076 Invalid implicit binds cause incorrect static var count in closure de [$why, $do, $we, $count]); ?> ---EXPECT-- -object(Closure)#1 (0) { +--EXPECTF-- +object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } diff --git a/Zend/tests/call_user_func_003.phpt b/Zend/tests/call_user_func_003.phpt index b501d803e776b..2ab46fff41a68 100644 --- a/Zend/tests/call_user_func_003.phpt +++ b/Zend/tests/call_user_func_003.phpt @@ -21,11 +21,15 @@ var_dump(call_user_func(function() use (&$foo) { return $foo; }, '__invoke')); ?> --EXPECTF-- string(3) "OK!" -object(Closure)#%d (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["instance"]=> - object(Closure)#%d (0) { + object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } } } diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt index 6a32f1970b563..4affcfec78e55 100644 --- a/Zend/tests/call_user_func_005.phpt +++ b/Zend/tests/call_user_func_005.phpt @@ -22,7 +22,9 @@ Deprecated: Optional parameter $a declared before required parameter $b is impli string(1) "x" array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["parameter"]=> array(2) { ["$a"]=> diff --git a/Zend/tests/closure_005.phpt b/Zend/tests/closure_005.phpt index 52b8d49059a09..238db84be46a9 100644 --- a/Zend/tests/closure_005.phpt +++ b/Zend/tests/closure_005.phpt @@ -73,6 +73,6 @@ Destroyed Fatal error: Uncaught Error: Using $this when not in object context in %sclosure_005.php:28 Stack trace: -#0 %s(%d): A::{closure}() +#0 %s(%d): A::{closure:%s:%d}() #1 {main} thrown in %sclosure_005.php on line 28 diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt index 880333570b3e4..996a7c5554c6f 100644 --- a/Zend/tests/closure_019.phpt +++ b/Zend/tests/closure_019.phpt @@ -26,7 +26,7 @@ int(9) Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4 int(81) -Fatal error: Uncaught Error: {closure}(): Argument #1 ($x) could not be passed by reference in %s:%d +Fatal error: Uncaught Error: {closure:%s:%d}(): Argument #1 ($x) could not be passed by reference in %s:%d Stack trace: #0 %s(%d): test() #1 {main} diff --git a/Zend/tests/closure_020.phpt b/Zend/tests/closure_020.phpt index 55a2a01b257a4..2eb057ec9dee4 100644 --- a/Zend/tests/closure_020.phpt +++ b/Zend/tests/closure_020.phpt @@ -28,7 +28,9 @@ object(foo)#%d (2) { ["test":"foo":private]=> int(3) ["a"]=> - object(Closure)#%d (2) { + object(Closure)#%d (3) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["a"]=> diff --git a/Zend/tests/closure_026.phpt b/Zend/tests/closure_026.phpt index c586a7d71efe6..6eb7ee5c4d9da 100644 --- a/Zend/tests/closure_026.phpt +++ b/Zend/tests/closure_026.phpt @@ -33,7 +33,9 @@ object(foo)#%d (1) { ["a"]=> array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["this"]=> *RECURSION* } @@ -44,7 +46,9 @@ int(1) string(1) "a" array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["this"]=> object(foo)#%d (1) { ["a"]=> diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt index 7ecfa55e0f14c..6e467856100a2 100644 --- a/Zend/tests/closure_027.phpt +++ b/Zend/tests/closure_027.phpt @@ -28,7 +28,7 @@ object(stdClass)#%d (0) { NULL Warning: Undefined variable $y in %s on line %d -Exception: Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected +Exception: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected Fatal error: Uncaught TypeError: test(): Argument #1 ($a) must be of type Closure, stdClass given, called in %s:%d Stack trace: diff --git a/Zend/tests/closure_032.phpt b/Zend/tests/closure_032.phpt index bf055c22856e2..5d1577b5fcb93 100644 --- a/Zend/tests/closure_032.phpt +++ b/Zend/tests/closure_032.phpt @@ -20,7 +20,7 @@ Array ( [file] => %s [line] => %d - [function] => {closure} + [function] => {closure:%s:%d} [args] => Array ( [0] => 23 @@ -29,14 +29,14 @@ Array ) ) -#0 %s(%d): {closure}(23) +#0 %s(%d): {closure:%s:%d}(23) Array ( [0] => Array ( [file] => %s [line] => %d - [function] => {closure} + [function] => {closure:%s:%d} [args] => Array ( [0] => 23 @@ -53,6 +53,7 @@ Array ( [0] => Closure Object ( + [name] => {closure:%s:%d} [parameter] => Array ( [$param] => @@ -65,5 +66,5 @@ Array ) ) -#0 %s(%d): {closure}(23) +#0 %s(%d): {closure:%s:%d}(23) #1 %s(%d): test(Object(Closure)) diff --git a/Zend/tests/closure_033.phpt b/Zend/tests/closure_033.phpt index 720497bd2de1c..9ac0ee17abe70 100644 --- a/Zend/tests/closure_033.phpt +++ b/Zend/tests/closure_033.phpt @@ -23,7 +23,7 @@ $o->func(); ?> ===DONE=== --EXPECTF-- -{closure}() +{closure:%s:%d}() Fatal error: Uncaught Error: Call to private method Test::func() from global scope in %s:%d Stack trace: diff --git a/Zend/tests/closure_034.phpt b/Zend/tests/closure_034.phpt index 27981a5c74be9..f4db8970dbbf7 100644 --- a/Zend/tests/closure_034.phpt +++ b/Zend/tests/closure_034.phpt @@ -8,7 +8,9 @@ var_dump($a); ?> --EXPECTF-- -object(Closure)#%d (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["a"]=> diff --git a/Zend/tests/closure_035.phpt b/Zend/tests/closure_035.phpt index 14c11a82196a3..88df9c408b1ad 100644 --- a/Zend/tests/closure_035.phpt +++ b/Zend/tests/closure_035.phpt @@ -15,7 +15,9 @@ var_dump($x()); ?> --EXPECTF-- -object(Closure)#%d (1) { +object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["x"]=> diff --git a/Zend/tests/closure_038.phpt b/Zend/tests/closure_038.phpt index b89ff93c4f44c..29c9f33544254 100644 --- a/Zend/tests/closure_038.phpt +++ b/Zend/tests/closure_038.phpt @@ -57,6 +57,6 @@ int(24) Fatal error: Uncaught Error: Cannot access private property B::$x in %s:%d Stack trace: -#0 %s(%d): Closure->{closure}() +#0 %s(%d): Closure->{closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/closure_039.phpt b/Zend/tests/closure_039.phpt index 760ad716e5c7c..3c7ea0d4d8ed4 100644 --- a/Zend/tests/closure_039.phpt +++ b/Zend/tests/closure_039.phpt @@ -57,6 +57,6 @@ int(24) Fatal error: Uncaught Error: Cannot access private property B::$x in %s:%d Stack trace: -#0 %s(%d): Closure->{closure}() +#0 %s(%d): Closure->{closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/closure_059.phpt b/Zend/tests/closure_059.phpt index 9ec04d02ae012..d8f7590db9022 100644 --- a/Zend/tests/closure_059.phpt +++ b/Zend/tests/closure_059.phpt @@ -34,6 +34,6 @@ try { } ?> --EXPECTF-- -Exception: {closure}(): Argument #1 ($a) must be of type A, B given, called in %s on line %d -Exception: {closure}(): Argument #1 ($a) must be of type A, B given -Exception: {closure}(): Argument #1 ($a) must be of type A, B given +Exception: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given, called in %s on line %d +Exception: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given +Exception: {closure:%s:%d}(): Argument #1 ($a) must be of type A, B given diff --git a/Zend/tests/deprecation_to_exception_during_inheritance.phpt b/Zend/tests/deprecation_to_exception_during_inheritance.phpt index dd0adec36a57c..6e7e81cd2957c 100644 --- a/Zend/tests/deprecation_to_exception_during_inheritance.phpt +++ b/Zend/tests/deprecation_to_exception_during_inheritance.phpt @@ -19,5 +19,5 @@ $class = new class extends DateTime { --EXPECTF-- Fatal error: During inheritance of DateTime: Uncaught Exception: Return type of DateTime@anonymous::getTimezone() should either be compatible with DateTime::getTimezone(): DateTimeZone|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in %s:%d Stack trace: -#0 %s(%d): {closure}(8192, 'Return type of ...', '%s', 8) +#0 %s(%d): {closure:%s:%d}(8192, 'Return type of ...', '%s', 8) #1 {main} in %s on line %d diff --git a/Zend/tests/exception_023.phpt b/Zend/tests/exception_023.phpt index 76892c82f2136..dd28cc6a9518f 100644 --- a/Zend/tests/exception_023.phpt +++ b/Zend/tests/exception_023.phpt @@ -11,6 +11,6 @@ Ensure proper backtraces with anon classes --EXPECTF-- Fatal error: Uncaught Exception in %s:%d Stack trace: -#0 %s(%d): {closure}(Object(class@anonymous)) +#0 %s(%d): {closure:%s:%d}(Object(class@anonymous)) #1 {main} thrown in %s on line %d diff --git a/Zend/tests/exception_during_variance_autoload.phpt b/Zend/tests/exception_during_variance_autoload.phpt index 2065f7fce6e6e..1f5c16ac27aa0 100644 --- a/Zend/tests/exception_during_variance_autoload.phpt +++ b/Zend/tests/exception_during_variance_autoload.phpt @@ -24,5 +24,5 @@ Q Fatal error: During inheritance of B, while autoloading Y: Uncaught Error: Class "Q" not found in %s:%d Stack trace: -#0 %s(%d): {closure}('Y') +#0 %s(%d): {closure:%s:%d}('Y') #1 {main} in %s on line %d diff --git a/Zend/tests/exception_during_variance_autoload_2.phpt b/Zend/tests/exception_during_variance_autoload_2.phpt index aacf78ddb9b16..8ff42e8f16a3b 100644 --- a/Zend/tests/exception_during_variance_autoload_2.phpt +++ b/Zend/tests/exception_during_variance_autoload_2.phpt @@ -16,5 +16,5 @@ class B extends A { --EXPECTF-- Fatal error: During inheritance of B, while autoloading Y: Uncaught Exception in %s:%d Stack trace: -#0 %s(%d): {closure}('Y') +#0 %s(%d): {closure:%s:%d}('Y') #1 {main} in %s on line %d diff --git a/Zend/tests/exception_ignore_args.phpt b/Zend/tests/exception_ignore_args.phpt index 6dcb872254b25..17fd31de0581c 100644 --- a/Zend/tests/exception_ignore_args.phpt +++ b/Zend/tests/exception_ignore_args.phpt @@ -13,6 +13,6 @@ $function("secrets", "arewrong"); --EXPECTF-- Fatal error: Uncaught Exception in %sexception_ignore_args.php:3 Stack trace: -#0 %sexception_ignore_args.php(8): {closure}() +#0 %s(%d): {closure:%s:%d}() #1 {main} thrown in %sexception_ignore_args.php on line 3 diff --git a/Zend/tests/fibers/backtrace-deep-nesting.phpt b/Zend/tests/fibers/backtrace-deep-nesting.phpt index 85968be429955..8f1c16550c4b5 100644 --- a/Zend/tests/fibers/backtrace-deep-nesting.phpt +++ b/Zend/tests/fibers/backtrace-deep-nesting.phpt @@ -48,7 +48,7 @@ Stack trace: #10 %sbacktrace-deep-nesting.php(%d): suspend_fiber(2) #11 %sbacktrace-deep-nesting.php(%d): suspend_fiber(1) #12 %sbacktrace-deep-nesting.php(%d): suspend_fiber(0) -#13 [internal function]: {closure}() +#13 [internal function]: {closure:%s:%d}() #14 %sbacktrace-deep-nesting.php(%d): Fiber->resume('test') #15 {main} thrown in %sbacktrace-deep-nesting.php on line %d diff --git a/Zend/tests/fibers/backtrace-nested.phpt b/Zend/tests/fibers/backtrace-nested.phpt index 4f97f3ea3b7e0..ad8ff3962c51f 100644 --- a/Zend/tests/fibers/backtrace-nested.phpt +++ b/Zend/tests/fibers/backtrace-nested.phpt @@ -22,7 +22,7 @@ $fiber->resume(); Fatal error: Uncaught Exception in %sbacktrace-nested.php:%d Stack trace: #0 %sbacktrace-nested.php(%d): suspend_fiber() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 %sbacktrace-nested.php(%d): Fiber->resume() #3 {main} thrown in %sbacktrace-nested.php on line %d diff --git a/Zend/tests/fibers/debug-backtrace.phpt b/Zend/tests/fibers/debug-backtrace.phpt index ef5ae8c9f0902..4b518090f5ecb 100644 --- a/Zend/tests/fibers/debug-backtrace.phpt +++ b/Zend/tests/fibers/debug-backtrace.phpt @@ -17,5 +17,5 @@ $fiber->start(); ?> --EXPECTF-- #0 %sdebug-backtrace.php(9): inner_function() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 %sdebug-backtrace.php(12): Fiber->start() diff --git a/Zend/tests/fibers/failing-fiber.phpt b/Zend/tests/fibers/failing-fiber.phpt index e0685eb3166d9..d587f66be35d7 100644 --- a/Zend/tests/fibers/failing-fiber.phpt +++ b/Zend/tests/fibers/failing-fiber.phpt @@ -19,7 +19,7 @@ string(4) "test" Fatal error: Uncaught Exception: test in %sfailing-fiber.php:%d Stack trace: -#0 [internal function]: {closure}() +#0 [internal function]: {closure:%s:%d}() #1 %sfailing-fiber.php(%d): Fiber->resume('test') #2 {main} thrown in %sfailing-fiber.php on line %d diff --git a/Zend/tests/fibers/failing-nested-fiber.phpt b/Zend/tests/fibers/failing-nested-fiber.phpt index f2216d0d58f05..ac7c4f9d965a6 100644 --- a/Zend/tests/fibers/failing-nested-fiber.phpt +++ b/Zend/tests/fibers/failing-nested-fiber.phpt @@ -22,9 +22,9 @@ int(3) Fatal error: Uncaught Exception: test in %sfailing-nested-fiber.php:6 Stack trace: -#0 [internal function]: {closure}(1, 2) +#0 [internal function]: {closure:%s:%d}(1, 2) #1 %sfailing-nested-fiber.php(%d): Fiber->resume(3) -#2 [internal function]: {closure}() +#2 [internal function]: {closure:%s:%d}() #3 %sfailing-nested-fiber.php(%d): Fiber->start() #4 {main} thrown in %sfailing-nested-fiber.php on line %d diff --git a/Zend/tests/fibers/get-return-after-bailout.phpt b/Zend/tests/fibers/get-return-after-bailout.phpt index 04bd464cfab0e..79ab70c98baae 100644 --- a/Zend/tests/fibers/get-return-after-bailout.phpt +++ b/Zend/tests/fibers/get-return-after-bailout.phpt @@ -27,6 +27,6 @@ Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d by Fatal error: Uncaught FiberError: Cannot get fiber return value: The fiber exited with a fatal error in %sget-return-after-bailout.php:%d Stack trace: #0 %sget-return-after-bailout.php(%d): Fiber->getReturn() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 {main} thrown in %sget-return-after-bailout.php on line %d diff --git a/Zend/tests/fibers/no-switch-force-close-finally.phpt b/Zend/tests/fibers/no-switch-force-close-finally.phpt index b483345bd67fd..62dce4c779aa0 100644 --- a/Zend/tests/fibers/no-switch-force-close-finally.phpt +++ b/Zend/tests/fibers/no-switch-force-close-finally.phpt @@ -26,6 +26,6 @@ finally Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %sno-switch-force-close-finally.php:%d Stack trace: #0 %sno-switch-force-close-finally.php(%d): Fiber->start() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 {main} thrown in %sno-switch-force-close-finally.php on line %d diff --git a/Zend/tests/fibers/no-switch-gc.phpt b/Zend/tests/fibers/no-switch-gc.phpt index 09e1c809a8f16..6773edc0ff27f 100644 --- a/Zend/tests/fibers/no-switch-gc.phpt +++ b/Zend/tests/fibers/no-switch-gc.phpt @@ -30,7 +30,7 @@ Stack trace: #0 %sno-switch-gc.php(%d): Fiber::suspend() #1 [internal function]: class@anonymous->__destruct() #2 %sno-switch-gc.php(%d): gc_collect_cycles() -#3 [internal function]: {closure}() +#3 [internal function]: {closure:%s:%d}() #4 %sno-switch-gc.php(%d): Fiber->start() #5 {main} thrown in %sno-switch-gc.php on line %d diff --git a/Zend/tests/fibers/resume-previous-fiber.phpt b/Zend/tests/fibers/resume-previous-fiber.phpt index 4865ef236f349..8e41303c134ff 100644 --- a/Zend/tests/fibers/resume-previous-fiber.phpt +++ b/Zend/tests/fibers/resume-previous-fiber.phpt @@ -20,9 +20,9 @@ $fiber->start(); Fatal error: Uncaught FiberError: Cannot resume a fiber that is not suspended in %sresume-previous-fiber.php:%d Stack trace: #0 %sresume-previous-fiber.php(%d): Fiber->resume() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 %sresume-previous-fiber.php(%d): Fiber->start() -#3 [internal function]: {closure}() +#3 [internal function]: {closure:%s:%d}() #4 %sresume-previous-fiber.php(%d): Fiber->start() #5 {main} thrown in %sresume-previous-fiber.php on line %d diff --git a/Zend/tests/fibers/resume-running-fiber.phpt b/Zend/tests/fibers/resume-running-fiber.phpt index 4295f7f918c07..269323984a3fa 100644 --- a/Zend/tests/fibers/resume-running-fiber.phpt +++ b/Zend/tests/fibers/resume-running-fiber.phpt @@ -15,7 +15,7 @@ $fiber->start(); Fatal error: Uncaught FiberError: Cannot resume a fiber that is not suspended in %sresume-running-fiber.php:%d Stack trace: #0 %sresume-running-fiber.php(%d): Fiber->resume() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 %sresume-running-fiber.php(%d): Fiber->start() #3 {main} thrown in %sresume-running-fiber.php on line %d diff --git a/Zend/tests/fibers/start-arguments.phpt b/Zend/tests/fibers/start-arguments.phpt index bdbb64f738799..6f22eb401762e 100644 --- a/Zend/tests/fibers/start-arguments.phpt +++ b/Zend/tests/fibers/start-arguments.phpt @@ -21,9 +21,9 @@ $fiber->start('test'); --EXPECTF-- int(1) -Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($x) must be of type int, string given in %sstart-arguments.php:%d +Fatal error: Uncaught TypeError: {closure:%s:%d}(): Argument #1 ($x) must be of type int, string given in %s:%d Stack trace: -#0 [internal function]: {closure}('test') +#0 [internal function]: {closure:%s:%d}('test') #1 %sstart-arguments.php(%d): Fiber->start('test') #2 {main} thrown in %sstart-arguments.php on line %d diff --git a/Zend/tests/fibers/suspend-in-force-close-fiber-after-shutdown.phpt b/Zend/tests/fibers/suspend-in-force-close-fiber-after-shutdown.phpt index ff7bf493206e3..1ae8818356df0 100644 --- a/Zend/tests/fibers/suspend-in-force-close-fiber-after-shutdown.phpt +++ b/Zend/tests/fibers/suspend-in-force-close-fiber-after-shutdown.phpt @@ -22,6 +22,6 @@ done Fatal error: Uncaught FiberError: Cannot suspend in a force-closed fiber in %ssuspend-in-force-close-fiber-after-shutdown.php:%d Stack trace: #0 %ssuspend-in-force-close-fiber-after-shutdown.php(%d): Fiber::suspend() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 {main} thrown in %ssuspend-in-force-close-fiber-after-shutdown.php on line %d diff --git a/Zend/tests/fibers/suspend-in-force-close-fiber.phpt b/Zend/tests/fibers/suspend-in-force-close-fiber.phpt index e552bab4c1efe..99b4bb106e30a 100644 --- a/Zend/tests/fibers/suspend-in-force-close-fiber.phpt +++ b/Zend/tests/fibers/suspend-in-force-close-fiber.phpt @@ -20,6 +20,6 @@ unset($fiber); Fatal error: Uncaught FiberError: Cannot suspend in a force-closed fiber in %ssuspend-in-force-close-fiber.php:%d Stack trace: #0 %ssuspend-in-force-close-fiber.php(%d): Fiber::suspend() -#1 [internal function]: {closure}() +#1 [internal function]: {closure:%s:%d}() #2 {main} thrown in %ssuspend-in-force-close-fiber.php on line %d diff --git a/Zend/tests/fibers/throw-during-fiber-destruct.phpt b/Zend/tests/fibers/throw-during-fiber-destruct.phpt index 804b85a71f8d0..b440f182af5ea 100644 --- a/Zend/tests/fibers/throw-during-fiber-destruct.phpt +++ b/Zend/tests/fibers/throw-during-fiber-destruct.phpt @@ -16,6 +16,6 @@ throw new Exception("Exception 1"); --EXPECTF-- Fatal error: Uncaught Exception: Exception 2 in %s:%d Stack trace: -#0 [internal function]: {closure}() +#0 [internal function]: {closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/fibers/throw-in-multiple-destroyed-fibers-after-shutdown.phpt b/Zend/tests/fibers/throw-in-multiple-destroyed-fibers-after-shutdown.phpt index a85d36c3a6de2..f2f09911fbb1d 100644 --- a/Zend/tests/fibers/throw-in-multiple-destroyed-fibers-after-shutdown.phpt +++ b/Zend/tests/fibers/throw-in-multiple-destroyed-fibers-after-shutdown.phpt @@ -37,11 +37,11 @@ done Fatal error: Uncaught Exception: test1 in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d Stack trace: -#0 [internal function]: {closure}() +#0 [internal function]: {closure:%s:%d}() #1 {main} Next Exception: test2 in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d Stack trace: -#0 [internal function]: {closure}() +#0 [internal function]: {closure:%s:%d}() #1 {main} thrown in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php on line %d diff --git a/Zend/tests/fibers/ticks.phpt b/Zend/tests/fibers/ticks.phpt index fbd050c09b950..4192398642c0a 100644 --- a/Zend/tests/fibers/ticks.phpt +++ b/Zend/tests/fibers/ticks.phpt @@ -26,8 +26,8 @@ $fiber->start(); Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %sticks.php:%d Stack trace: #0 %sticks.php(%d): Fiber::suspend() -#1 %sticks.php(%d): {closure}() -#2 [internal function]: {closure}() +#1 %s(%d): {closure:%s:%d}() +#2 [internal function]: {closure:%s:%d}() #3 %sticks.php(%d): Fiber->start() #4 {main} thrown in %sticks.php on line %d diff --git a/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt b/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt index aec3008e92177..d3a7b7229e8d0 100644 --- a/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt +++ b/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt @@ -58,7 +58,7 @@ $bar( unset($foo, $bar,); var_dump(isset($foo, $bar,)); ?> ---EXPECT-- +--EXPECTF-- foo array(2) { [0]=> @@ -87,7 +87,7 @@ array(2) { [1]=> string(3) "bar" } -{closure} +{closure:%s:%d} array(2) { [0]=> string(7) "closure" diff --git a/Zend/tests/function_arguments/sensitive_parameter_arrow_function.phpt b/Zend/tests/function_arguments/sensitive_parameter_arrow_function.phpt index da57bc55e7f46..4650f91994bc6 100644 --- a/Zend/tests/function_arguments/sensitive_parameter_arrow_function.phpt +++ b/Zend/tests/function_arguments/sensitive_parameter_arrow_function.phpt @@ -17,7 +17,7 @@ array(1) { ["line"]=> int(5) ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(1) { [0]=> diff --git a/Zend/tests/function_arguments/sensitive_parameter_closure.phpt b/Zend/tests/function_arguments/sensitive_parameter_closure.phpt index f2b038ceab953..f1fe7ddaf2b10 100644 --- a/Zend/tests/function_arguments/sensitive_parameter_closure.phpt +++ b/Zend/tests/function_arguments/sensitive_parameter_closure.phpt @@ -14,7 +14,7 @@ $test('sensitive'); ?> --EXPECTF-- -#0 %ssensitive_parameter_closure.php(10): {closure}(Object(SensitiveParameterValue)) +#0 %s(%d): {closure:%s:%d}(Object(SensitiveParameterValue)) array(1) { [0]=> array(4) { @@ -23,7 +23,7 @@ array(1) { ["line"]=> int(10) ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(1) { [0]=> @@ -40,7 +40,7 @@ array(1) { ["line"]=> int(10) ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(1) { [0]=> diff --git a/Zend/tests/generators/gh11028_2.phpt b/Zend/tests/generators/gh11028_2.phpt index 27b36c711f5c1..ddc9618e8ed85 100644 --- a/Zend/tests/generators/gh11028_2.phpt +++ b/Zend/tests/generators/gh11028_2.phpt @@ -19,6 +19,6 @@ Warning: Undefined variable $a in %s on line %d Fatal error: Uncaught Error: Keys must be of type int|string during array unpacking in %s:%d Stack trace: -#0 %s(%d): {closure}() +#0 %s(%d): {closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/gh10695_4.phpt b/Zend/tests/gh10695_4.phpt index c97477d444013..92d0d2ea5eaff 100644 --- a/Zend/tests/gh10695_4.phpt +++ b/Zend/tests/gh10695_4.phpt @@ -14,6 +14,6 @@ Caught: main Fatal error: Uncaught Exception: exception handler in %s:%d Stack trace: -#0 [internal function]: {closure}(Object(Exception)) +#0 [internal function]: {closure:%s:%d}(Object(Exception)) #1 {main} thrown in %s on line %d diff --git a/Zend/tests/gh8810_3.phpt b/Zend/tests/gh8810_3.phpt index 99fb449ce2fc0..71f3a2c8d90a5 100644 --- a/Zend/tests/gh8810_3.phpt +++ b/Zend/tests/gh8810_3.phpt @@ -14,6 +14,6 @@ GH-8810: Fix reported line number of multi-line closure call --EXPECTF-- Fatal error: Uncaught Exception in %s:4 Stack trace: -#0 %s(6): {closure}('foo') +#0 %s(%d): {closure:%s:%d}('foo') #1 {main} thrown in %s on line 4 diff --git a/Zend/tests/gh8841.phpt b/Zend/tests/gh8841.phpt index d99ca62c28773..5587c5ad8227e 100644 --- a/Zend/tests/gh8841.phpt +++ b/Zend/tests/gh8841.phpt @@ -25,6 +25,6 @@ Before calling f() Fatal error: Uncaught Error: Call to undefined function f() in %s:%d Stack trace: -#0 [internal function]: {closure}() +#0 [internal function]: {closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/gh9916-009.phpt b/Zend/tests/gh9916-009.phpt index 75643d871dea0..471c5f5655350 100644 --- a/Zend/tests/gh9916-009.phpt +++ b/Zend/tests/gh9916-009.phpt @@ -28,8 +28,8 @@ Finally Fatal error: Uncaught Error: Cannot use "yield from" in a force-closed generator in %s:%d Stack trace: -#0 [internal function]: {closure}() +#0 [internal function]: {closure:%s:%d}() #1 %s(%d): Generator->current() -#2 [internal function]: {closure}() +#2 [internal function]: {closure:%s:%d}() #3 {main} thrown in %s on line %d diff --git a/Zend/tests/match/029.phpt b/Zend/tests/match/029.phpt index e4f9d64ea4189..a6103df05fd64 100644 --- a/Zend/tests/match/029.phpt +++ b/Zend/tests/match/029.phpt @@ -18,6 +18,6 @@ echo "unreachable\n"; --EXPECTF-- Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s029.php:4 Stack trace: -#0 %s029.php(7): {closure}(%d, 'Undefined varia...', '%s', %d) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 7) #1 {main} thrown in %s029.php on line 4 diff --git a/Zend/tests/match/030.phpt b/Zend/tests/match/030.phpt index 53588600bd7ce..feeaa1c49ca02 100644 --- a/Zend/tests/match/030.phpt +++ b/Zend/tests/match/030.phpt @@ -18,6 +18,6 @@ echo "unreachable\n"; --EXPECTF-- Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s030.php:4 Stack trace: -#0 %s030.php(7): {closure}(%d, 'Undefined varia...', '%s', %d) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 7) #1 {main} thrown in %s030.php on line 4 diff --git a/Zend/tests/named_params/call_user_func.phpt b/Zend/tests/named_params/call_user_func.phpt index 2e6f9257dbf72..50f2ed588e92f 100644 --- a/Zend/tests/named_params/call_user_func.phpt +++ b/Zend/tests/named_params/call_user_func.phpt @@ -79,10 +79,10 @@ array(2) { string(1) "C" } -Warning: {closure}(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d a = a, b = b, c = D NULL -{closure}(): Argument #1 ($a) not passed +{closure:%s:%d}(): Argument #1 ($a) not passed array_slice(): Argument #2 ($offset) not passed array(2) { [3]=> diff --git a/Zend/tests/nested_method_and_function.phpt b/Zend/tests/nested_method_and_function.phpt index 5965a9274c3ce..5b5c530adc109 100644 --- a/Zend/tests/nested_method_and_function.phpt +++ b/Zend/tests/nested_method_and_function.phpt @@ -27,13 +27,13 @@ $c = Foo::bar(); $c(); ?> ---EXPECT-- +--EXPECTF-- string(7) "Baz\foo" string(7) "Baz\foo" string(0) "" string(3) "bar" string(12) "Baz\Foo::bar" string(7) "Baz\Foo" -string(13) "Baz\{closure}" -string(13) "Baz\{closure}" +string(%d) "Baz\{closure:%s:%d}" +string(%d) "Baz\{closure:%s:%d}" string(7) "Baz\Foo" diff --git a/Zend/tests/return_types/011.phpt b/Zend/tests/return_types/011.phpt index 76cd6934e80c4..b1aa49a3d221b 100644 --- a/Zend/tests/return_types/011.phpt +++ b/Zend/tests/return_types/011.phpt @@ -10,4 +10,6 @@ var_dump(foo()); ?> --EXPECTF-- object(Closure)#%d (%d) { + ["name"]=> + string(%d) "{closure:%s:%d}" } diff --git a/Zend/tests/return_types/012.phpt b/Zend/tests/return_types/012.phpt index 6bddbffe8eb71..f12809d3dfa23 100644 --- a/Zend/tests/return_types/012.phpt +++ b/Zend/tests/return_types/012.phpt @@ -14,14 +14,16 @@ class foo { $baz = new foo(); var_dump($baz->bar()); ?> ---EXPECT-- -object(Closure)#2 (2) { +--EXPECTF-- +object(Closure)#%d (3) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["static"]=> array(1) { ["test"]=> string(3) "one" } ["this"]=> - object(foo)#1 (0) { + object(foo)#%d (0) { } } diff --git a/Zend/tests/return_types/013.phpt b/Zend/tests/return_types/013.phpt index aa3631a22dc9a..5faf54da6d7f4 100644 --- a/Zend/tests/return_types/013.phpt +++ b/Zend/tests/return_types/013.phpt @@ -15,8 +15,8 @@ $baz = new foo(); var_dump($func=$baz->bar(), $func()); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: foo::{closure}(): Return value must be of type array, null returned in %s:%d +Fatal error: Uncaught TypeError: foo::{closure:%s:%d}(): Return value must be of type array, null returned in %s:%d Stack trace: -#0 %s(%d): foo->{closure}() +#0 %s(%d): foo->{closure:%s:%d}() #1 {main} thrown in %s on line %d diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt index 41b057abf63b5..75a7fab5fd17e 100644 --- a/Zend/tests/type_declarations/callable_001.phpt +++ b/Zend/tests/type_declarations/callable_001.phpt @@ -21,7 +21,9 @@ foo(array("bar", "baz")); --EXPECTF-- string(6) "strpos" string(3) "foo" -object(Closure)#1 (0) { +object(Closure)#%d (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } array(2) { [0]=> diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt index c69d17c8c7004..6b2cf736edbf9 100644 --- a/Zend/tests/type_declarations/scalar_basic.phpt +++ b/Zend/tests/type_declarations/scalar_basic.phpt @@ -76,19 +76,19 @@ E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line int(1) *** Trying string(2) "1a" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying int(%d) int(%d) *** Trying float(NAN) -*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) int(1) @@ -97,22 +97,22 @@ int(1) int(0) *** Trying NULL -*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -129,13 +129,13 @@ float(1) float(1.5) *** Trying string(2) "1a" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying int(%d) float(%s) @@ -150,22 +150,22 @@ float(1) float(0) *** Trying NULL -*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: @@ -203,22 +203,22 @@ string(1) "1" string(0) "" *** Trying NULL -*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } string(6) "foobar" *** Trying resource(%d) of type (stream) -*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: @@ -256,21 +256,21 @@ bool(true) bool(false) *** Trying NULL -*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object(stdClass)#%s (0) { } -*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying object(StringCapable)#%s (0) { } -*** Caught {closure}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d *** Trying resource(%d) of type (stream) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_none.phpt b/Zend/tests/type_declarations/scalar_none.phpt index 5b639757c0eb2..678c9d994e1bc 100644 --- a/Zend/tests/type_declarations/scalar_none.phpt +++ b/Zend/tests/type_declarations/scalar_none.phpt @@ -26,13 +26,13 @@ echo PHP_EOL . "Done"; ?> --EXPECTF-- Testing int: -*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected +*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected Testing float: -*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected +*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected Testing string: -*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected +*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected Testing bool: -*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected +*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected Testing int nullable: NULL Testing float nullable: diff --git a/Zend/tests/type_declarations/scalar_null.phpt b/Zend/tests/type_declarations/scalar_null.phpt index d1ade3ad48c43..042c1f157a68c 100644 --- a/Zend/tests/type_declarations/scalar_null.phpt +++ b/Zend/tests/type_declarations/scalar_null.phpt @@ -27,13 +27,13 @@ echo PHP_EOL . "Done"; ?> --EXPECTF-- Testing int: -*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d Testing float: -*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d Testing string: -*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d Testing bool: -*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d Testing int nullable: NULL Testing float nullable: diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt index 644ff58299440..da930b98d9b65 100644 --- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt @@ -74,32 +74,32 @@ int(1) E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line %d int(1) *** Trying string(2) "1a" -*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d *** Trying int(9223372036854775807) int(9223372036854775807) *** Trying float(NAN) -*** Caught {closure}(): Return value must be of type int, float returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d *** Trying bool(true) int(1) *** Trying bool(false) int(0) *** Trying NULL -*** Caught {closure}(): Return value must be of type int, null returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Return value must be of type int, array returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d *** Trying object(stdClass)#6 (0) { } -*** Caught {closure}(): Return value must be of type int, stdClass returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d *** Trying object(StringCapable)#7 (0) { } -*** Caught {closure}(): Return value must be of type int, StringCapable returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Return value must be of type int, resource returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d Testing 'float' type: *** Trying int(1) @@ -111,11 +111,11 @@ float(1) *** Trying float(1.5) float(1.5) *** Trying string(2) "1a" -*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d *** Trying int(9223372036854775807) float(9.223372036854776E+18) *** Trying float(NAN) @@ -125,18 +125,18 @@ float(1) *** Trying bool(false) float(0) *** Trying NULL -*** Caught {closure}(): Return value must be of type float, null returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Return value must be of type float, array returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d *** Trying object(stdClass)#6 (0) { } -*** Caught {closure}(): Return value must be of type float, stdClass returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d *** Trying object(StringCapable)#7 (0) { } -*** Caught {closure}(): Return value must be of type float, StringCapable returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Return value must be of type float, resource returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d Testing 'string' type: *** Trying int(1) @@ -162,18 +162,18 @@ string(1) "1" *** Trying bool(false) string(0) "" *** Trying NULL -*** Caught {closure}(): Return value must be of type string, null returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Return value must be of type string, array returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d *** Trying object(stdClass)#6 (0) { } -*** Caught {closure}(): Return value must be of type string, stdClass returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d *** Trying object(StringCapable)#7 (0) { } string(6) "foobar" *** Trying resource(5) of type (stream) -*** Caught {closure}(): Return value must be of type string, resource returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d Testing 'bool' type: *** Trying int(1) @@ -199,17 +199,17 @@ bool(true) *** Trying bool(false) bool(false) *** Trying NULL -*** Caught {closure}(): Return value must be of type bool, null returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type bool, null returned in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Return value must be of type bool, array returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d *** Trying object(stdClass)#6 (0) { } -*** Caught {closure}(): Return value must be of type bool, stdClass returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d *** Trying object(StringCapable)#7 (0) { } -*** Caught {closure}(): Return value must be of type bool, StringCapable returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Return value must be of type bool, resource returned in %s on line %d +*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_strict_64bit.phpt b/Zend/tests/type_declarations/scalar_strict_64bit.phpt index 5d4dd0edeb682..6335e2d1acee4 100644 --- a/Zend/tests/type_declarations/scalar_strict_64bit.phpt +++ b/Zend/tests/type_declarations/scalar_strict_64bit.phpt @@ -60,52 +60,52 @@ Testing 'int' type: int(1) *** Trying string(1) "1" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying float(1) -*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying float(1.5) -*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying string(2) "1a" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying int(9223372036854775807) int(9223372036854775807) *** Trying float(NAN) -*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying bool(true) -*** Caught {closure}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d *** Trying bool(false) -*** Caught {closure}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d *** Trying NULL -*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object(stdClass)#5 (0) { } -*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying object(StringCapable)#6 (0) { } -*** Caught {closure}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -113,7 +113,7 @@ Testing 'float' type: float(1) *** Trying string(1) "1" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying float(1) float(1) @@ -122,13 +122,13 @@ float(1) float(1.5) *** Trying string(2) "1a" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying int(9223372036854775807) float(9.223372036854776E+18) @@ -137,42 +137,42 @@ float(9.223372036854776E+18) float(NAN) *** Trying bool(true) -*** Caught {closure}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d *** Trying bool(false) -*** Caught {closure}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d *** Trying NULL -*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object(stdClass)#5 (0) { } -*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying object(StringCapable)#6 (0) { } -*** Caught {closure}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: *** Trying int(1) -*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d *** Trying string(1) "1" string(1) "1" *** Trying float(1) -*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying float(1.5) -*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying string(2) "1a" string(2) "1a" @@ -184,63 +184,63 @@ string(1) "a" string(0) "" *** Trying int(9223372036854775807) -*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d *** Trying float(NAN) -*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying bool(true) -*** Caught {closure}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d *** Trying bool(false) -*** Caught {closure}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d *** Trying NULL -*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object(stdClass)#5 (0) { } -*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying object(StringCapable)#6 (0) { } -*** Caught {closure}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: *** Trying int(1) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d *** Trying string(1) "1" -*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying float(1) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying float(1.5) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying string(2) "1a" -*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying string(1) "a" -*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying string(0) "" -*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying int(9223372036854775807) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d *** Trying float(NAN) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying bool(true) bool(true) @@ -249,21 +249,21 @@ bool(true) bool(false) *** Trying NULL -*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array(0) { } -*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object(stdClass)#5 (0) { } -*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying object(StringCapable)#6 (0) { } -*** Caught {closure}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d *** Trying resource(5) of type (stream) -*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/scalar_strict_basic.phpt b/Zend/tests/type_declarations/scalar_strict_basic.phpt index 296e8f7ad63a8..462bed7983d6c 100644 --- a/Zend/tests/type_declarations/scalar_strict_basic.phpt +++ b/Zend/tests/type_declarations/scalar_strict_basic.phpt @@ -57,28 +57,28 @@ Testing 'int' type: int(1) *** Trying float value -*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d *** Trying string value -*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d *** Trying true value -*** Caught {closure}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d *** Trying false value -*** Caught {closure}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d *** Trying null value -*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d *** Trying array value -*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d *** Trying object value -*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d Testing 'float' type: @@ -89,65 +89,65 @@ float(1) float(1) *** Trying string value -*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d *** Trying true value -*** Caught {closure}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d *** Trying false value -*** Caught {closure}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d *** Trying null value -*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d *** Trying array value -*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d *** Trying object value -*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d Testing 'string' type: *** Trying integer value -*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d *** Trying float value -*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d *** Trying string value string(1) "1" *** Trying true value -*** Caught {closure}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d *** Trying false value -*** Caught {closure}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d *** Trying null value -*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d *** Trying array value -*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d *** Trying object value -*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d Testing 'bool' type: *** Trying integer value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d *** Trying float value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d *** Trying string value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d *** Trying true value bool(true) @@ -156,15 +156,15 @@ bool(true) bool(false) *** Trying null value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d *** Trying array value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d *** Trying object value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d *** Trying resource value -*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d +*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d Done diff --git a/Zend/tests/type_declarations/static_type_return.phpt b/Zend/tests/type_declarations/static_type_return.phpt index 820f4b0d6f071..0d37a80046507 100644 --- a/Zend/tests/type_declarations/static_type_return.phpt +++ b/Zend/tests/type_declarations/static_type_return.phpt @@ -67,25 +67,25 @@ $test = $test->bindTo($a); var_dump($test($a)); ?> ---EXPECT-- -object(A)#3 (0) { +--EXPECTF-- +object(A)#%d (0) { } -object(B)#3 (0) { +object(B)#%d (0) { } -object(A)#3 (0) { +object(A)#%d (0) { } A::test2(): Return value must be of type B, A returned -object(A)#3 (0) { +object(A)#%d (0) { } -object(C)#3 (0) { +object(C)#%d (0) { } -object(A)#3 (0) { +object(A)#%d (0) { } A::test4(): Return value must be of type B|array, A returned -{closure}(): Return value must be of type static, stdClass returned -object(A)#1 (0) { +{closure:%s:%d}(): Return value must be of type static, stdClass returned +object(A)#%d (0) { } diff --git a/Zend/tests/type_declarations/typed_properties_055.phpt b/Zend/tests/type_declarations/typed_properties_055.phpt index 36afb48a51883..c3a04d5a815b1 100644 --- a/Zend/tests/type_declarations/typed_properties_055.phpt +++ b/Zend/tests/type_declarations/typed_properties_055.phpt @@ -24,6 +24,6 @@ int(2) Fatal error: Uncaught TypeError: Cannot assign string to reference held by property A::$bar of type int in %s:%d Stack trace: -#0 %s(%d): {closure}(2) +#0 %s(%d): {closure:%s:%d}(2) #1 {main} thrown in %s on line %d diff --git a/Zend/tests/type_declarations/union_types/type_checking_strict.phpt b/Zend/tests/type_declarations/union_types/type_checking_strict.phpt index 31460f5d5719c..a2a0584b5cef9 100644 --- a/Zend/tests/type_declarations/union_types/type_checking_strict.phpt +++ b/Zend/tests/type_declarations/union_types/type_checking_strict.phpt @@ -61,91 +61,91 @@ test('string|array', $values); test('bool|array', $values); ?> ---EXPECT-- +--EXPECTF-- Type int|float: 42 => 42 42.0 => 42.0 INF => INF -"42" => Argument ... must be of type int|float, string given -"42.0" => Argument ... must be of type int|float, string given -"42x" => Argument ... must be of type int|float, string given -"x" => Argument ... must be of type int|float, string given -"" => Argument ... must be of type int|float, string given -true => Argument ... must be of type int|float, true given -false => Argument ... must be of type int|float, false given -null => Argument ... must be of type int|float, null given -[] => Argument ... must be of type int|float, array given -new stdClass => Argument ... must be of type int|float, stdClass given -new WithToString => Argument ... must be of type int|float, WithToString given +"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +true => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, true given +false => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, false given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, WithToString given Type int|float|false: 42 => 42 42.0 => 42.0 INF => INF -"42" => Argument ... must be of type int|float|false, string given -"42.0" => Argument ... must be of type int|float|false, string given -"42x" => Argument ... must be of type int|float|false, string given -"x" => Argument ... must be of type int|float|false, string given -"" => Argument ... must be of type int|float|false, string given -true => Argument ... must be of type int|float|false, true given +"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +true => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, true given false => false -null => Argument ... must be of type int|float|false, null given -[] => Argument ... must be of type int|float|false, array given -new stdClass => Argument ... must be of type int|float|false, stdClass given -new WithToString => Argument ... must be of type int|float|false, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, WithToString given Type int|float|bool: 42 => 42 42.0 => 42.0 INF => INF -"42" => Argument ... must be of type int|float|bool, string given -"42.0" => Argument ... must be of type int|float|bool, string given -"42x" => Argument ... must be of type int|float|bool, string given -"x" => Argument ... must be of type int|float|bool, string given -"" => Argument ... must be of type int|float|bool, string given +"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given +"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given true => true false => false -null => Argument ... must be of type int|float|bool, null given -[] => Argument ... must be of type int|float|bool, array given -new stdClass => Argument ... must be of type int|float|bool, stdClass given -new WithToString => Argument ... must be of type int|float|bool, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, WithToString given Type int|bool: 42 => 42 -42.0 => Argument ... must be of type int|bool, float given -INF => Argument ... must be of type int|bool, float given -"42" => Argument ... must be of type int|bool, string given -"42.0" => Argument ... must be of type int|bool, string given -"42x" => Argument ... must be of type int|bool, string given -"x" => Argument ... must be of type int|bool, string given -"" => Argument ... must be of type int|bool, string given +42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, float given +INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, float given +"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given +"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given true => true false => false -null => Argument ... must be of type int|bool, null given -[] => Argument ... must be of type int|bool, array given -new stdClass => Argument ... must be of type int|bool, stdClass given -new WithToString => Argument ... must be of type int|bool, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, WithToString given Type int|string|null: 42 => 42 -42.0 => Argument ... must be of type string|int|null, float given -INF => Argument ... must be of type string|int|null, float given +42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, float given +INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, float given "42" => "42" "42.0" => "42.0" "42x" => "42x" "x" => "x" "" => "" -true => Argument ... must be of type string|int|null, true given -false => Argument ... must be of type string|int|null, false given +true => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, true given +false => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, false given null => null -[] => Argument ... must be of type string|int|null, array given -new stdClass => Argument ... must be of type string|int|null, stdClass given -new WithToString => Argument ... must be of type string|int|null, WithToString given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, WithToString given Type string|bool: -42 => Argument ... must be of type string|bool, int given -42.0 => Argument ... must be of type string|bool, float given -INF => Argument ... must be of type string|bool, float given +42 => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, int given +42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, float given +INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, float given "42" => "42" "42.0" => "42.0" "42x" => "42x" @@ -153,55 +153,55 @@ INF => Argument ... must be of type string|bool, float given "" => "" true => true false => false -null => Argument ... must be of type string|bool, null given -[] => Argument ... must be of type string|bool, array given -new stdClass => Argument ... must be of type string|bool, stdClass given -new WithToString => Argument ... must be of type string|bool, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, WithToString given Type float|array: 42 => 42.0 42.0 => 42.0 INF => INF -"42" => Argument ... must be of type array|float, string given -"42.0" => Argument ... must be of type array|float, string given -"42x" => Argument ... must be of type array|float, string given -"x" => Argument ... must be of type array|float, string given -"" => Argument ... must be of type array|float, string given -true => Argument ... must be of type array|float, true given -false => Argument ... must be of type array|float, false given -null => Argument ... must be of type array|float, null given +"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +true => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, true given +false => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, false given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, null given [] => [] -new stdClass => Argument ... must be of type array|float, stdClass given -new WithToString => Argument ... must be of type array|float, WithToString given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, WithToString given Type string|array: -42 => Argument ... must be of type array|string, int given -42.0 => Argument ... must be of type array|string, float given -INF => Argument ... must be of type array|string, float given +42 => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, int given +42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, float given +INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, float given "42" => "42" "42.0" => "42.0" "42x" => "42x" "x" => "x" "" => "" -true => Argument ... must be of type array|string, true given -false => Argument ... must be of type array|string, false given -null => Argument ... must be of type array|string, null given +true => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, true given +false => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, false given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, null given [] => [] -new stdClass => Argument ... must be of type array|string, stdClass given -new WithToString => Argument ... must be of type array|string, WithToString given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, WithToString given Type bool|array: -42 => Argument ... must be of type array|bool, int given -42.0 => Argument ... must be of type array|bool, float given -INF => Argument ... must be of type array|bool, float given -"42" => Argument ... must be of type array|bool, string given -"42.0" => Argument ... must be of type array|bool, string given -"42x" => Argument ... must be of type array|bool, string given -"x" => Argument ... must be of type array|bool, string given -"" => Argument ... must be of type array|bool, string given +42 => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, int given +42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, float given +INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, float given +"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given +"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given true => true false => false -null => Argument ... must be of type array|bool, null given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, null given [] => [] -new stdClass => Argument ... must be of type array|bool, stdClass given -new WithToString => Argument ... must be of type array|bool, WithToString given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, WithToString given diff --git a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt index 351a3e9e78ede..9031b002b2a09 100644 --- a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt +++ b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt @@ -59,22 +59,22 @@ test('string|array', $values); test('bool|array', $values); ?> ---EXPECT-- +--EXPECTF-- Type int|float: 42 => 42 42.0 => 42.0 INF => INF "42" => 42 "42.0" => 42.0 -"42x" => Argument ... must be of type int|float, string given -"x" => Argument ... must be of type int|float, string given -"" => Argument ... must be of type int|float, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given true => 1 false => 0 -null => Argument ... must be of type int|float, null given -[] => Argument ... must be of type int|float, array given -new stdClass => Argument ... must be of type int|float, stdClass given -new WithToString => Argument ... must be of type int|float, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, WithToString given Type int|float|false: 42 => 42 @@ -82,15 +82,15 @@ Type int|float|false: INF => INF "42" => 42 "42.0" => 42.0 -"42x" => Argument ... must be of type int|float|false, string given -"x" => Argument ... must be of type int|float|false, string given -"" => Argument ... must be of type int|float|false, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given true => 1 false => false -null => Argument ... must be of type int|float|false, null given -[] => Argument ... must be of type int|float|false, array given -new stdClass => Argument ... must be of type int|float|false, stdClass given -new WithToString => Argument ... must be of type int|float|false, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, WithToString given Type int|float|bool: 42 => 42 @@ -103,10 +103,10 @@ INF => INF "" => false true => true false => false -null => Argument ... must be of type int|float|bool, null given -[] => Argument ... must be of type int|float|bool, array given -new stdClass => Argument ... must be of type int|float|bool, stdClass given -new WithToString => Argument ... must be of type int|float|bool, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, WithToString given Type int|bool: 42 => 42 @@ -119,10 +119,10 @@ INF => true "" => false true => true false => false -null => Argument ... must be of type int|bool, null given -[] => Argument ... must be of type int|bool, array given -new stdClass => Argument ... must be of type int|bool, stdClass given -new WithToString => Argument ... must be of type int|bool, WithToString given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, WithToString given Type int|string|null: 42 => 42 @@ -136,8 +136,8 @@ INF => "INF" true => 1 false => 0 null => null -[] => Argument ... must be of type string|int|null, array given -new stdClass => Argument ... must be of type string|int|null, stdClass given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|int|null, stdClass given new WithToString => "__toString()" Type string|bool: @@ -151,9 +151,9 @@ INF => "INF" "" => "" true => true false => false -null => Argument ... must be of type string|bool, null given -[] => Argument ... must be of type string|bool, array given -new stdClass => Argument ... must be of type string|bool, stdClass given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, null given +[] => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, array given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type string|bool, stdClass given new WithToString => "__toString()" Type float|array: @@ -162,15 +162,15 @@ Type float|array: INF => INF "42" => 42.0 "42.0" => 42.0 -"42x" => Argument ... must be of type array|float, string given -"x" => Argument ... must be of type array|float, string given -"" => Argument ... must be of type array|float, string given +"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given +"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given true => 1.0 false => 0.0 -null => Argument ... must be of type array|float, null given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, null given [] => [] -new stdClass => Argument ... must be of type array|float, stdClass given -new WithToString => Argument ... must be of type array|float, WithToString given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, WithToString given Type string|array: 42 => "42" @@ -183,9 +183,9 @@ INF => "INF" "" => "" true => "1" false => "" -null => Argument ... must be of type array|string, null given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, null given [] => [] -new stdClass => Argument ... must be of type array|string, stdClass given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|string, stdClass given new WithToString => "__toString()" Type bool|array: @@ -199,7 +199,7 @@ INF => true "" => false true => true false => false -null => Argument ... must be of type array|bool, null given +null => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, null given [] => [] -new stdClass => Argument ... must be of type array|bool, stdClass given -new WithToString => Argument ... must be of type array|bool, WithToString given +new stdClass => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, stdClass given +new WithToString => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, WithToString given diff --git a/Zend/tests/type_declarations/variance/loading_exception1.phpt b/Zend/tests/type_declarations/variance/loading_exception1.phpt index b535e49112542..ea5be4e56f055 100644 --- a/Zend/tests/type_declarations/variance/loading_exception1.phpt +++ b/Zend/tests/type_declarations/variance/loading_exception1.phpt @@ -44,5 +44,5 @@ Class A does not exist Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class A does not exist in %s:%d Stack trace: -#0 %s(%d): {closure}('A') +#0 %s(%d): {closure:%s:%d}('A') #1 {main} in %s on line %d diff --git a/Zend/tests/type_declarations/variance/loading_exception2.phpt b/Zend/tests/type_declarations/variance/loading_exception2.phpt index f29264325855f..db9c6b276581d 100644 --- a/Zend/tests/type_declarations/variance/loading_exception2.phpt +++ b/Zend/tests/type_declarations/variance/loading_exception2.phpt @@ -46,5 +46,5 @@ Class I does not exist Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class I does not exist in %s:%d Stack trace: -#0 %s(%d): {closure}('I') +#0 %s(%d): {closure:%s:%d}('I') #1 {main} in %s on line %d diff --git a/Zend/tests/undef_var_in_verify_return.phpt b/Zend/tests/undef_var_in_verify_return.phpt index b8c263c424cf4..f3966c6992d6b 100644 --- a/Zend/tests/undef_var_in_verify_return.phpt +++ b/Zend/tests/undef_var_in_verify_return.phpt @@ -17,7 +17,7 @@ test(); --EXPECTF-- Fatal error: Uncaught ErrorException: Undefined variable $test in %s:%d Stack trace: -#0 %s(%d): {closure}(2, 'Undefined varia...', '%s', 8) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 8) #1 %s(%d): test() #2 {main} thrown in %s on line %d diff --git a/Zend/tests/use_unlinked_class.phpt b/Zend/tests/use_unlinked_class.phpt index 17e12418dbef4..92d21242c2285 100644 --- a/Zend/tests/use_unlinked_class.phpt +++ b/Zend/tests/use_unlinked_class.phpt @@ -15,6 +15,6 @@ class A implements I { Fatal error: Uncaught ReflectionException: Class "A" does not exist in %s:%d Stack trace: #0 %s(%d): ReflectionClass->__construct('A') -#1 %s(%d): {closure}('I') +#1 %s(%d): {closure:%s:%d}('I') #2 {main} thrown in %s on line %d diff --git a/ext/opcache/tests/jit/assign_055.phpt b/ext/opcache/tests/jit/assign_055.phpt index f359f4f9e710a..38ced05b0db46 100644 --- a/ext/opcache/tests/jit/assign_055.phpt +++ b/ext/opcache/tests/jit/assign_055.phpt @@ -19,6 +19,6 @@ try { --EXPECTF-- Fatal error: Uncaught Error: Undefined constant "y" in %sassign_055.php:3 Stack trace: -#0 %sassign_055.php(7): {closure}(2, 'Undefined varia...', '%s', 7) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 7) #1 {main} - thrown in %sassign_055.php on line 3 \ No newline at end of file + thrown in %sassign_055.php on line 3 diff --git a/ext/opcache/tests/jit/fetch_dim_rw_004.phpt b/ext/opcache/tests/jit/fetch_dim_rw_004.phpt index f1a1073760406..ae639c8f56ba7 100644 --- a/ext/opcache/tests/jit/fetch_dim_rw_004.phpt +++ b/ext/opcache/tests/jit/fetch_dim_rw_004.phpt @@ -12,9 +12,9 @@ $k=[]; $y[$k]++; ?> --EXPECTF-- -Fatal error: Uncaught TypeError: {closure}(): Argument #1 ($y) must be of type y, int given, called in %sfetch_dim_rw_004.php:2 +Fatal error: Uncaught TypeError: {closure:%s:%d}(): Argument #1 ($y) must be of type y, int given, called in %s on line %d and defined in %s:%d Stack trace: -#0 %sfetch_dim_rw_004.php(5): {closure}(2, 'Undefined varia...', '%s', 5) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 5) #1 {main} Next TypeError: Cannot access offset of type array on array in %sfetch_dim_rw_004.php:5 diff --git a/ext/opcache/tests/jit/fetch_obj_006.phpt b/ext/opcache/tests/jit/fetch_obj_006.phpt index 0b02c405f9e5b..1d18844ab0bd0 100644 --- a/ext/opcache/tests/jit/fetch_obj_006.phpt +++ b/ext/opcache/tests/jit/fetch_obj_006.phpt @@ -24,6 +24,6 @@ $appendProp2(); --EXPECTF-- Fatal error: Uncaught Error: Cannot indirectly modify readonly property Test::$prop in %s:%d Stack trace: -#0 %sfetch_obj_006.php(15): Test->{closure}() +#0 %s(%d): Test->{closure:%s:%d}() #1 {main} thrown in %sfetch_obj_006.php on line 13 diff --git a/ext/opcache/tests/jit/not_003.phpt b/ext/opcache/tests/jit/not_003.phpt index 19deecab8416f..a358fc2275782 100644 --- a/ext/opcache/tests/jit/not_003.phpt +++ b/ext/opcache/tests/jit/not_003.phpt @@ -12,6 +12,6 @@ set_error_handler(function(){y;}) . !$y; --EXPECTF-- Fatal error: Uncaught Error: Undefined constant "y" in %snot_003.php:2 Stack trace: -#0 %snot_003.php(2): {closure}(2, '%s', '%s', 2) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 2) #1 {main} - thrown in %snot_003.php on line 2 \ No newline at end of file + thrown in %snot_003.php on line 2 diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt index 53622ec19ca3e..8e90f7a010a98 100644 --- a/ext/reflection/tests/007.phpt +++ b/ext/reflection/tests/007.phpt @@ -90,7 +90,7 @@ test('WithCtorWithArgs'); ?> --EXPECTF-- ====>Class_does_not_exist -{closure}(Class_does_not_exist) +{closure:%s:%d}(Class_does_not_exist) string(43) "Class "Class_does_not_exist" does not exist" ====>NoCtor ====>newInstance() diff --git a/ext/reflection/tests/ReflectionFiber_basic.phpt b/ext/reflection/tests/ReflectionFiber_basic.phpt index a81c05c98e884..a435926a6e0b3 100644 --- a/ext/reflection/tests/ReflectionFiber_basic.phpt +++ b/ext/reflection/tests/ReflectionFiber_basic.phpt @@ -65,7 +65,7 @@ array(2) { [1]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } @@ -96,7 +96,7 @@ array(2) { [1]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } diff --git a/ext/reflection/tests/ReflectionFiber_bug_gh11121_1.phpt b/ext/reflection/tests/ReflectionFiber_bug_gh11121_1.phpt index de0c9abec9ee5..e9d3fa644e225 100644 --- a/ext/reflection/tests/ReflectionFiber_bug_gh11121_1.phpt +++ b/ext/reflection/tests/ReflectionFiber_bug_gh11121_1.phpt @@ -54,7 +54,7 @@ array(3) { [2]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } diff --git a/ext/reflection/tests/ReflectionFiber_bug_gh11121_2.phpt b/ext/reflection/tests/ReflectionFiber_bug_gh11121_2.phpt index b7affb2ca0b1c..ee0bdb868a94f 100644 --- a/ext/reflection/tests/ReflectionFiber_bug_gh11121_2.phpt +++ b/ext/reflection/tests/ReflectionFiber_bug_gh11121_2.phpt @@ -55,7 +55,7 @@ array(3) { [2]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } diff --git a/ext/reflection/tests/ReflectionFiber_notrace_2.phpt b/ext/reflection/tests/ReflectionFiber_notrace_2.phpt index 85cb4ebd20a71..1a810daa5c14a 100644 --- a/ext/reflection/tests/ReflectionFiber_notrace_2.phpt +++ b/ext/reflection/tests/ReflectionFiber_notrace_2.phpt @@ -53,7 +53,7 @@ array(3) { [2]=> array(2) { ["function"]=> - string(14) "test\{closure}" + string(%d) "test\{closure:%s:%d}" ["args"]=> array(0) { } diff --git a/ext/reflection/tests/ReflectionGenerator_basic.phpt b/ext/reflection/tests/ReflectionGenerator_basic.phpt index 9f497234c24a9..715b6fa14ea85 100644 --- a/ext/reflection/tests/ReflectionGenerator_basic.phpt +++ b/ext/reflection/tests/ReflectionGenerator_basic.phpt @@ -84,7 +84,7 @@ array(1) { [0]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } @@ -96,7 +96,7 @@ object(Generator)#4 (0) { } object(ReflectionFunction)#7 (1) { ["name"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" } NULL object(Generator)#5 (0) { diff --git a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt index 1f78fcb6be236..9fcf5c05483d5 100644 --- a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt +++ b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt @@ -37,7 +37,7 @@ array(1) { [0]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } @@ -49,7 +49,7 @@ object(Generator)#2 (0) { } object(ReflectionFunction)#4 (1) { ["name"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" } NULL array(2) { @@ -60,7 +60,7 @@ array(2) { ["line"]=> int(%d) ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } @@ -68,7 +68,7 @@ array(2) { [1]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } @@ -80,6 +80,6 @@ object(Generator)#5 (0) { } object(ReflectionFunction)#6 (1) { ["name"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" } NULL diff --git a/ext/reflection/tests/bug80299.phpt b/ext/reflection/tests/bug80299.phpt index 61aec5b1ce05b..eccc360acebb0 100644 --- a/ext/reflection/tests/bug80299.phpt +++ b/ext/reflection/tests/bug80299.phpt @@ -12,4 +12,4 @@ $function = function (int &$foo, DateTimeInterface &$bar) {}; ?> --EXPECTF-- -Warning: {closure}(): Argument #1 ($foo) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($foo) must be passed by reference, value given in %s on line %d diff --git a/ext/reflection/tests/closures_003_v1.phpt b/ext/reflection/tests/closures_003_v1.phpt index 1ae5502a3965b..6b6214bef12b6 100644 --- a/ext/reflection/tests/closures_003_v1.phpt +++ b/ext/reflection/tests/closures_003_v1.phpt @@ -18,6 +18,6 @@ unset ($parameter); echo $method->getName ()."\n"; ?> ---EXPECT-- -{closure} -{closure} +--EXPECTF-- +{closure:%s:%d} +{closure:%s:%d} diff --git a/ext/spl/tests/bug71236.phpt b/ext/spl/tests/bug71236.phpt index 55c7cb88fef75..f44c621700298 100644 --- a/ext/spl/tests/bug71236.phpt +++ b/ext/spl/tests/bug71236.phpt @@ -8,10 +8,12 @@ spl_autoload_register(); var_dump(spl_autoload_functions()); ?> ---EXPECT-- +--EXPECTF-- array(2) { [0]=> - object(Closure)#1 (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["parameter"]=> array(1) { ["$class"]=> diff --git a/ext/spl/tests/bug72051.phpt b/ext/spl/tests/bug72051.phpt index 42cc1ea8330c4..7bb72d769e34b 100644 --- a/ext/spl/tests/bug72051.phpt +++ b/ext/spl/tests/bug72051.phpt @@ -18,7 +18,7 @@ $callbackTest->next(); print_r($data); ?> --EXPECTF-- -Warning: {closure}(): Argument #1 ($current) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($current) must be passed by reference, value given in %s on line %d Array ( [0] => 1 diff --git a/ext/spl/tests/spl_autoload_013.phpt b/ext/spl/tests/spl_autoload_013.phpt index fe71562273d58..9e722c8a01de3 100644 --- a/ext/spl/tests/spl_autoload_013.phpt +++ b/ext/spl/tests/spl_autoload_013.phpt @@ -29,7 +29,9 @@ var_dump(spl_autoload_functions()); --EXPECTF-- array(3) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["parameter"]=> array(1) { ["$class"]=> diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt index 769618e6ec8b9..2f7bac4c91461 100644 --- a/ext/standard/tests/array/array_map_variation10.phpt +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -36,7 +36,7 @@ try { echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing array_map() : anonymous callback function *** -- anonymous function with all parameters and body -- array(3) { @@ -63,7 +63,7 @@ array(3) { } } -- anonymous function with two parameters and passing one array -- -Exception: Too few arguments to function {closure}(), 1 passed and exactly 2 expected +Exception: Too few arguments to function {closure:%s:%d}(), 1 passed and exactly 2 expected -- anonymous function with NULL parameter -- array(3) { [0]=> diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index aab0002e46602..c96f92dcb54a2 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -108,19 +108,19 @@ bool(true) closure with array -Warning: {closure}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d array(1) { ["sum"]=> int(42) } -Warning: {closure}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d array(1) { ["sum"]=> int(42) } -Warning: {closure}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d array(1) { ["sum"]=> int(42) @@ -146,19 +146,19 @@ End result:int(48) closure with object -Warning: {closure}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d object(stdClass)#1 (1) { ["sum"]=> int(42) } -Warning: {closure}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d object(stdClass)#1 (1) { ["sum"]=> int(43) } -Warning: {closure}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($udata) must be passed by reference, value given in %s on line %d object(stdClass)#1 (1) { ["sum"]=> int(45) @@ -203,7 +203,7 @@ array(2) { [0]=> array(2) { ["function"]=> - string(9) "{closure}" + string(%d) "{closure:%s:%d}" ["args"]=> array(2) { [0]=> @@ -232,7 +232,9 @@ array(2) { int(3) } [1]=> - object(Closure)#2 (1) { + object(Closure)#%d (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["parameter"]=> array(2) { ["$v"]=> diff --git a/ext/standard/tests/array/bug52719.phpt b/ext/standard/tests/array/bug52719.phpt index 2cfeb734b4937..6b04661ebd102 100644 --- a/ext/standard/tests/array/bug52719.phpt +++ b/ext/standard/tests/array/bug52719.phpt @@ -12,7 +12,7 @@ array_walk_recursive( echo "Done"; ?> --EXPECTF-- -Warning: {closure}(): Argument #3 ($userdata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($userdata) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #3 ($userdata) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #3 ($userdata) must be passed by reference, value given in %s on line %d Done diff --git a/ext/standard/tests/array/uasort_variation7.phpt b/ext/standard/tests/array/uasort_variation7.phpt index ec3c6cdf397d7..cb26a755cc534 100644 --- a/ext/standard/tests/array/uasort_variation7.phpt +++ b/ext/standard/tests/array/uasort_variation7.phpt @@ -52,21 +52,21 @@ array(5) { } -- Anonymous 'cmp_function' with parameters passed by reference -- -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d bool(true) array(4) { ["a"]=> diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt index 02e2cac7f22bc..58cdac98acf6c 100644 --- a/ext/standard/tests/array/usort_variation7.phpt +++ b/ext/standard/tests/array/usort_variation7.phpt @@ -52,21 +52,21 @@ array(5) { -- Anonymous 'cmp_function' with parameters passed by reference -- -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #1 ($value1) must be passed by reference, value given in %s on line %d -Warning: {closure}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d +Warning: {closure:%s:%d}(): Argument #2 ($value2) must be passed by reference, value given in %s on line %d bool(true) array(4) { [0]=> diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt index c931ef189556f..982cbc9d11be4 100644 --- a/ext/standard/tests/serialize/bug30234.phpt +++ b/ext/standard/tests/serialize/bug30234.phpt @@ -28,8 +28,8 @@ var_dump(class_exists('autoload_implements', false)); --EXPECTF-- bool(false) bool(false) -{closure}(autoload_interface) -{closure}(Autoload_Implements) +{closure:%s:%d}(autoload_interface) +{closure:%s:%d}(Autoload_Implements) object(autoload_implements)#%d (0) { } bool(true) diff --git a/ext/zend_test/tests/gh10695_2.phpt b/ext/zend_test/tests/gh10695_2.phpt index d60dbf8e7dae5..68bae31fe2ddb 100644 --- a/ext/zend_test/tests/gh10695_2.phpt +++ b/ext/zend_test/tests/gh10695_2.phpt @@ -13,6 +13,6 @@ $resource = zend_test_create_throwing_resource(); --EXPECTF-- Fatal error: Uncaught Exception: Caught in %s:%d Stack trace: -#0 [internal function]: {closure}(Object(Exception)) +#0 [internal function]: {closure:%s:%d}(Object(Exception)) #1 {main} thrown in %s on line %d diff --git a/ext/zend_test/tests/observer_backtrace_01.phpt b/ext/zend_test/tests/observer_backtrace_01.phpt index 7f021bf402515..7dd4ec6950333 100644 --- a/ext/zend_test/tests/observer_backtrace_01.phpt +++ b/ext/zend_test/tests/observer_backtrace_01.phpt @@ -82,9 +82,9 @@ var_dump(foo()); {main} %s%eobserver_backtrace_%d.php --> - + - + - - + + - + diff --git a/ext/zend_test/tests/observer_closure_01.phpt b/ext/zend_test/tests/observer_closure_01.phpt index a7b9776ea8484..ddca4da0a99ce 100644 --- a/ext/zend_test/tests/observer_closure_01.phpt +++ b/ext/zend_test/tests/observer_closure_01.phpt @@ -26,11 +26,11 @@ echo 'DONE' . PHP_EOL; --EXPECTF-- - - <{closure}> + + <{closure:%s:%d}> Answer - - <{closure}> + + <{closure:%s:%d}> @@ -38,27 +38,27 @@ Answer int(42) - - - <{closure}> + + + <{closure:%s:%d}> Answer - <{closure}> + <{closure:%s:%d}> int(42) - - - <{closure}> + + + <{closure:%s:%d}> Answer - <{closure}> + <{closure:%s:%d}> int(42) - - + + DONE diff --git a/ext/zend_test/tests/observer_error_05.phpt b/ext/zend_test/tests/observer_error_05.phpt index 9debfc2b0ad27..b0d7d5992f6b4 100644 --- a/ext/zend_test/tests/observer_error_05.phpt +++ b/ext/zend_test/tests/observer_error_05.phpt @@ -29,13 +29,13 @@ echo 'You should not see this.'; - - <{closure}> + + <{closure:%s:%d}> Fatal error: Foo error in %s on line %d - + diff --git a/ext/zend_test/tests/observer_fiber_01.phpt b/ext/zend_test/tests/observer_fiber_01.phpt index a70df36b0bbcd..66281089e6d93 100644 --- a/ext/zend_test/tests/observer_fiber_01.phpt +++ b/ext/zend_test/tests/observer_fiber_01.phpt @@ -25,7 +25,7 @@ $fiber->resume(); - + diff --git a/ext/zend_test/tests/observer_fiber_02.phpt b/ext/zend_test/tests/observer_fiber_02.phpt index 34fe42c10f203..b23a9773331b0 100644 --- a/ext/zend_test/tests/observer_fiber_02.phpt +++ b/ext/zend_test/tests/observer_fiber_02.phpt @@ -21,7 +21,7 @@ $fiber->start(); - + diff --git a/ext/zend_test/tests/observer_fiber_03.phpt b/ext/zend_test/tests/observer_fiber_03.phpt index d55e8d9e84c90..84bf7811eca92 100644 --- a/ext/zend_test/tests/observer_fiber_03.phpt +++ b/ext/zend_test/tests/observer_fiber_03.phpt @@ -44,7 +44,7 @@ $fiber->resume(); - + @@ -55,7 +55,7 @@ $fiber->resume(); int(1) - + diff --git a/ext/zend_test/tests/observer_fiber_04.phpt b/ext/zend_test/tests/observer_fiber_04.phpt index 29e1b2d086851..39dc2c8def3e3 100644 --- a/ext/zend_test/tests/observer_fiber_04.phpt +++ b/ext/zend_test/tests/observer_fiber_04.phpt @@ -31,7 +31,7 @@ $fiber->resume(); - + @@ -40,7 +40,7 @@ $fiber->resume(); - + diff --git a/ext/zend_test/tests/observer_fiber_05.phpt b/ext/zend_test/tests/observer_fiber_05.phpt index ce589033f97f5..c119c98c877d7 100644 --- a/ext/zend_test/tests/observer_fiber_05.phpt +++ b/ext/zend_test/tests/observer_fiber_05.phpt @@ -30,7 +30,7 @@ $fiber->resume(); - + @@ -39,7 +39,7 @@ $fiber->resume(); - + diff --git a/ext/zend_test/tests/observer_fiber_06.phpt b/ext/zend_test/tests/observer_fiber_06.phpt index 7176336c5ffac..e7a75cdc4ed71 100644 --- a/ext/zend_test/tests/observer_fiber_06.phpt +++ b/ext/zend_test/tests/observer_fiber_06.phpt @@ -27,7 +27,7 @@ try { - + diff --git a/ext/zend_test/tests/observer_fiber_functions_01.phpt b/ext/zend_test/tests/observer_fiber_functions_01.phpt index d3d395bd302fc..f98b18c286aa2 100644 --- a/ext/zend_test/tests/observer_fiber_functions_01.phpt +++ b/ext/zend_test/tests/observer_fiber_functions_01.phpt @@ -32,8 +32,8 @@ $fiber->resume(); - - <{closure}> + + <{closure:%s:%d}> int(1) @@ -51,9 +51,9 @@ int(1) int(2) - + - \ No newline at end of file + diff --git a/ext/zend_test/tests/observer_fiber_functions_02.phpt b/ext/zend_test/tests/observer_fiber_functions_02.phpt index c2b7eb007fae7..df815cfc30c59 100644 --- a/ext/zend_test/tests/observer_fiber_functions_02.phpt +++ b/ext/zend_test/tests/observer_fiber_functions_02.phpt @@ -31,8 +31,8 @@ $fiber->start(); - - <{closure}> + + <{closure:%s:%d}> int(1) @@ -48,7 +48,7 @@ int(1) - + - \ No newline at end of file + diff --git a/ext/zend_test/tests/observer_fiber_functions_03.phpt b/ext/zend_test/tests/observer_fiber_functions_03.phpt index d96390068a2f5..79a531896d3de 100644 --- a/ext/zend_test/tests/observer_fiber_functions_03.phpt +++ b/ext/zend_test/tests/observer_fiber_functions_03.phpt @@ -40,8 +40,8 @@ $fiber->resume(); - - <{closure}> + + <{closure:%s:%d}> int(1) @@ -57,8 +57,8 @@ int(1) - - <{closure}> + + <{closure:%s:%d}> int(2) @@ -76,9 +76,9 @@ int(2) Fatal error: Allowed memory size of 104857600 bytes exhausted %s on line %d - + - \ No newline at end of file + diff --git a/ext/zend_test/tests/observer_shutdown_01.phpt b/ext/zend_test/tests/observer_shutdown_01.phpt index b0ee1bd1a039b..ef17d84125cdb 100644 --- a/ext/zend_test/tests/observer_shutdown_01.phpt +++ b/ext/zend_test/tests/observer_shutdown_01.phpt @@ -34,8 +34,8 @@ echo 'Done: ' . bar(40) . PHP_EOL; Done: 40 - -<{closure}> + +<{closure:%s:%d}> @@ -44,4 +44,4 @@ Done: 40 Shutdown: 42 - + diff --git a/sapi/phpdbg/tests/exceptions_001.phpt b/sapi/phpdbg/tests/exceptions_001.phpt index 99989654cf813..2ebdc0f664d1f 100644 --- a/sapi/phpdbg/tests/exceptions_001.phpt +++ b/sapi/phpdbg/tests/exceptions_001.phpt @@ -13,13 +13,13 @@ prompt> handle first >00016: foo(); // Error 00017: } catch (\Exception $e) { 00018: var_dump($e); -prompt> frame #0: {closure}() at %s:16 +prompt> frame #0: {closure:%s:%d}() at %s:16 frame #1: {main} at %s:22 prompt> 3 prompt> [Uncaught Error in %s on line 16] Error: Call to undefined function foo() in %s:16 Stack trace: -#0 %s(22): {closure}() +#0 %s(22): {closure:%s:%d}() #1 {main} [Script ended normally] prompt> diff --git a/sapi/phpdbg/tests/exceptions_002.phpt b/sapi/phpdbg/tests/exceptions_002.phpt index f304cc25db7bc..47d4c7d11c7da 100644 --- a/sapi/phpdbg/tests/exceptions_002.phpt +++ b/sapi/phpdbg/tests/exceptions_002.phpt @@ -17,13 +17,13 @@ prompt> Fatal error: Uncaught Error: Call to undefined function next_error() in eval()'d code:1 Stack trace: #0 %s(16): unknown() -#1 %s(20): {closure}() +#1 %s(20): {closure:%s:%d}() #2 {main} thrown in eval()'d code on line 1 prompt> [Uncaught Error in %s on line 16] Error: Call to undefined function foo() in %s:16 Stack trace: -#0 %s(20): {closure}() +#0 %s(20): {closure:%s:%d}() #1 {main} [Script ended normally] prompt> [The stack contains nothing !] From 885e088f826cfd9e846752620b2e0667dc90b77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 28 Feb 2024 10:08:00 +0100 Subject: [PATCH 04/13] Adjust tests for closure naming that were not caught locally --- Zend/tests/closure_065.phpt | 2 +- Zend/tests/fibers/signal-async.phpt | 4 ++-- Zend/tests/fibers/signal-dispatch.phpt | 4 ++-- ext/ffi/tests/bug79177.phpt | 2 +- .../libxml_set_external_entity_loader_error1.phpt | 4 ++-- ext/opcache/tests/jit/closure_001.phpt | 14 ++++++++++---- .../XML_OPTION_PARSE_HUGE_during_parsing.phpt | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Zend/tests/closure_065.phpt b/Zend/tests/closure_065.phpt index 35e9213b2eddc..4be0a8bd128df 100644 --- a/Zend/tests/closure_065.phpt +++ b/Zend/tests/closure_065.phpt @@ -7,7 +7,7 @@ var_dump(function($foo) { }); --EXPECTF-- object(Closure)#1 (2) { ["name"]=> - string(70) "{closure:%s:2}" + string(%d) "{closure:%s:2}" ["parameter"]=> array(1) { ["$foo"]=> diff --git a/Zend/tests/fibers/signal-async.phpt b/Zend/tests/fibers/signal-async.phpt index f1f5a2f4c8f2d..2487f874d30dc 100644 --- a/Zend/tests/fibers/signal-async.phpt +++ b/Zend/tests/fibers/signal-async.phpt @@ -30,8 +30,8 @@ Fiber start Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %ssignal-async.php:%d Stack trace: #0 %ssignal-async.php(%d): Fiber::suspend() -#1 %ssignal-async.php(%d): {closure}(%d, Array) -#2 [internal function]: {closure}() +#1 %ssignal-async.php(%d): {closure:%s:%d}(%d, Array) +#2 [internal function]: {closure:%s:%d}() #3 %ssignal-async.php(%d): Fiber->start() #4 {main} thrown in %ssignal-async.php on line %d diff --git a/Zend/tests/fibers/signal-dispatch.phpt b/Zend/tests/fibers/signal-dispatch.phpt index abde8e313d76e..f0f36328d791e 100644 --- a/Zend/tests/fibers/signal-dispatch.phpt +++ b/Zend/tests/fibers/signal-dispatch.phpt @@ -38,9 +38,9 @@ Fiber start FiberError: Cannot switch fibers in current execution context in %ssignal-dispatch.php:%d Stack trace: #0 %ssignal-dispatch.php(%d): Fiber::suspend() -#1 [internal function]: {closure}(%d, Array) +#1 [internal function]: {closure:%s:%d}(%d, Array) #2 %ssignal-dispatch.php(%d): pcntl_signal_dispatch() -#3 [internal function]: {closure}() +#3 [internal function]: {closure:%s:%d}() #4 %ssignal-dispatch.php(%d): Fiber->start() #5 {main} Fiber end diff --git a/ext/ffi/tests/bug79177.phpt b/ext/ffi/tests/bug79177.phpt index aaabfdbca012f..2b6e449d36d6a 100644 --- a/ext/ffi/tests/bug79177.phpt +++ b/ext/ffi/tests/bug79177.phpt @@ -32,7 +32,7 @@ echo "done\n"; --EXPECTF-- Warning: Uncaught RuntimeException: Not allowed in %s:%d Stack trace: -#0 %s(%d): {closure}() +#0 %s(%d): {closure:%s:%d}() #1 %s(%d): FFI->bug79177() #2 {main} thrown in %s on line %d diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt index 5c0cf471d8aff..050aa7830680a 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt @@ -21,7 +21,7 @@ try { echo "Done.\n"; ?> ---EXPECT-- +--EXPECTF-- bool(true) -Exception: Too few arguments to function {closure}(), 3 passed and exactly 4 expected +Exception: Too few arguments to function {closure:%s:%d}(), 3 passed and exactly 4 expected Done. diff --git a/ext/opcache/tests/jit/closure_001.phpt b/ext/opcache/tests/jit/closure_001.phpt index 073115af0a24d..baede7bd1ffa4 100644 --- a/ext/opcache/tests/jit/closure_001.phpt +++ b/ext/opcache/tests/jit/closure_001.phpt @@ -30,16 +30,22 @@ var_dump($f->call($foo)); var_dump($f->call($foo)); var_dump($f()); ?> ---EXPECT-- -object(Closure)#3 (1) { +--EXPECTF-- +object(Closure)#3 (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["this"]=> object(Foo)#1 (0) { } } -object(Closure)#3 (1) { +object(Closure)#3 (2) { + ["name"]=> + string(%d) "{closure:%s:%d}" ["this"]=> object(Foo)#1 (0) { } } -object(Closure)#3 (0) { +object(Closure)#3 (1) { + ["name"]=> + string(%d) "{closure:%s:%d}" } diff --git a/ext/xml/tests/XML_OPTION_PARSE_HUGE_during_parsing.phpt b/ext/xml/tests/XML_OPTION_PARSE_HUGE_during_parsing.phpt index 6b19052b78aac..58f1e2615f376 100644 --- a/ext/xml/tests/XML_OPTION_PARSE_HUGE_during_parsing.phpt +++ b/ext/xml/tests/XML_OPTION_PARSE_HUGE_during_parsing.phpt @@ -21,7 +21,7 @@ xml_parse($parser, "", true); Fatal error: Uncaught Error: Cannot change option XML_OPTION_PARSE_HUGE while parsing in %s:%d Stack trace: #0 %s(%d): xml_parser_set_option(Object(XMLParser), 5, true) -#1 [internal function]: {closure}(Object(XMLParser), 'FOO', Array) +#1 [internal function]: {closure:%s:%d}(Object(XMLParser), 'FOO', Array) #2 %s(%d): xml_parse(Object(XMLParser), '', true) #3 {main} thrown in %s on line %d From 91483903bf14b926bfb4e34f2d8112d38d98a495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 6 Mar 2024 12:30:46 +0100 Subject: [PATCH 05/13] Drop the namespace from closure names This is redundant with the included filename. --- Zend/tests/bug74164.phpt | 4 ++-- Zend/tests/nested_method_and_function.phpt | 4 ++-- Zend/zend_compile.c | 9 +++------ ext/reflection/tests/ReflectionFiber_notrace_2.phpt | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Zend/tests/bug74164.phpt b/Zend/tests/bug74164.phpt index e0b8a014107be..ef56f10225fd2 100644 --- a/Zend/tests/bug74164.phpt +++ b/Zend/tests/bug74164.phpt @@ -12,9 +12,9 @@ set_error_handler(function ($type, $msg) { call_user_func(function (array &$ref) {var_dump("xxx");}, 'not_an_array_variable'); ?> --EXPECTF-- -Fatal error: Uncaught Exception: Foo\{closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s:%d +Fatal error: Uncaught Exception: {closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s:%d Stack trace: -#0 [internal function]: Foo\{closure:%s:%d}(2, '%s', '%s', 9) +#0 [internal function]: {closure:%s:%d}(2, '%s', '%s', 9) #1 %sbug74164.php(%d): call_user_func(%s) #2 {main} thrown in %sbug74164.php on line %d diff --git a/Zend/tests/nested_method_and_function.phpt b/Zend/tests/nested_method_and_function.phpt index 5b5c530adc109..36884e8f9e3b0 100644 --- a/Zend/tests/nested_method_and_function.phpt +++ b/Zend/tests/nested_method_and_function.phpt @@ -34,6 +34,6 @@ string(0) "" string(3) "bar" string(12) "Baz\Foo::bar" string(7) "Baz\Foo" -string(%d) "Baz\{closure:%s:%d}" -string(%d) "Baz\{closure:%s:%d}" +string(%d) "{closure:%s:%d}" +string(%d) "{closure:%s:%d}" string(7) "Baz\Foo" diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index af541e6b4f430..400a14bfa6188 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7668,12 +7668,12 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, if (op_array->fn_flags & ZEND_ACC_CLOSURE) { zend_string *filename = op_array->filename; uint32_t start_lineno = decl->start_lineno; - unqualified_name = zend_strpprintf(0, "{closure:%s:%" PRIu32 "}", ZSTR_VAL(filename), start_lineno); + op_array->function_name = name = unqualified_name = zend_strpprintf(0, "{closure:%s:%" PRIu32 "}", ZSTR_VAL(filename), start_lineno); } else { - unqualified_name = zend_string_copy(decl->name); + unqualified_name = decl->name; + op_array->function_name = name = zend_prefix_with_ns(unqualified_name); } - op_array->function_name = name = zend_prefix_with_ns(unqualified_name); lcname = zend_string_tolower(name); if (FC(imports_function)) { @@ -7710,9 +7710,6 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, opline->op2.num = func_ref; } } - - zend_string_release(unqualified_name); - return lcname; } /* }}} */ diff --git a/ext/reflection/tests/ReflectionFiber_notrace_2.phpt b/ext/reflection/tests/ReflectionFiber_notrace_2.phpt index 1a810daa5c14a..bd9078fc33c85 100644 --- a/ext/reflection/tests/ReflectionFiber_notrace_2.phpt +++ b/ext/reflection/tests/ReflectionFiber_notrace_2.phpt @@ -53,7 +53,7 @@ array(3) { [2]=> array(2) { ["function"]=> - string(%d) "test\{closure:%s:%d}" + string(%d) "{closure:%s:%d}" ["args"]=> array(0) { } From 4cc992751f727f06a0e97caa09e7ade5988bea0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 15 Mar 2024 12:12:12 +0100 Subject: [PATCH 06/13] Include filename and line number as separate keys in Closure debug info --- Zend/tests/bug52193.phpt | 42 +++++++++++++++---- Zend/tests/bug60738.phpt | 6 ++- Zend/tests/bug60738_variation.phpt | 6 ++- Zend/tests/bug70321.phpt | 12 +++++- Zend/tests/bug75290.phpt | 6 ++- Zend/tests/bug79778.phpt | 24 +++++++++-- Zend/tests/bug81076.phpt | 6 ++- Zend/tests/call_user_func_003.phpt | 12 +++++- Zend/tests/call_user_func_005.phpt | 6 ++- Zend/tests/closure_020.phpt | 6 ++- Zend/tests/closure_026.phpt | 12 +++++- Zend/tests/closure_032.phpt | 2 + Zend/tests/closure_034.phpt | 6 ++- Zend/tests/closure_035.phpt | 6 ++- Zend/tests/closure_065.phpt | 6 ++- Zend/tests/return_types/011.phpt | 4 ++ Zend/tests/return_types/012.phpt | 6 ++- .../tests/type_declarations/callable_001.phpt | 6 ++- Zend/zend_closures.c | 6 +++ ext/spl/tests/bug71236.phpt | 6 ++- ext/spl/tests/spl_autoload_013.phpt | 6 ++- .../tests/array/array_walk_closure.phpt | 6 ++- 22 files changed, 168 insertions(+), 30 deletions(-) diff --git a/Zend/tests/bug52193.phpt b/Zend/tests/bug52193.phpt index 42c379151d036..7fe0f1c71a60a 100644 --- a/Zend/tests/bug52193.phpt +++ b/Zend/tests/bug52193.phpt @@ -35,57 +35,85 @@ array(0) { } array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } int(2) array(1) { [0]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["h"]=> &array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } } } } -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["h"]=> &array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } } } array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } array(2) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } [1]=> int(5) diff --git a/Zend/tests/bug60738.phpt b/Zend/tests/bug60738.phpt index 662b335078b6c..d2ef9a46297a5 100644 --- a/Zend/tests/bug60738.phpt +++ b/Zend/tests/bug60738.phpt @@ -16,9 +16,13 @@ trigger_error('Error!'); --EXPECTF-- NULL Intercepted error! -object(Closure)#%d (1) { +object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } Notice: Error! in %s on line %d diff --git a/Zend/tests/bug60738_variation.phpt b/Zend/tests/bug60738_variation.phpt index 519d44f99d915..4d0ca8b6417ed 100644 --- a/Zend/tests/bug60738_variation.phpt +++ b/Zend/tests/bug60738_variation.phpt @@ -13,9 +13,13 @@ throw new Exception('Exception!'); ?> --EXPECTF-- NULL -object(Closure)#%d (1) { +object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } Fatal error: Uncaught Exception: Exception! in %s:%d diff --git a/Zend/tests/bug70321.phpt b/Zend/tests/bug70321.phpt index bddfc9129e9fc..7791779127660 100644 --- a/Zend/tests/bug70321.phpt +++ b/Zend/tests/bug70321.phpt @@ -39,15 +39,23 @@ var_dump($foo->bar->onBaz); --EXPECTF-- array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } array(1) { [0]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } diff --git a/Zend/tests/bug75290.phpt b/Zend/tests/bug75290.phpt index 2a23a8af30ccf..0a1b125378513 100644 --- a/Zend/tests/bug75290.phpt +++ b/Zend/tests/bug75290.phpt @@ -18,9 +18,13 @@ object(Closure)#%d (2) { string(10) "" } } -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["parameter"]=> array(1) { ["$someThing"]=> diff --git a/Zend/tests/bug79778.phpt b/Zend/tests/bug79778.phpt index 09bc5d3276d3f..fa2e2771dcec3 100644 --- a/Zend/tests/bug79778.phpt +++ b/Zend/tests/bug79778.phpt @@ -25,9 +25,13 @@ print_r($closure1); ?> --EXPECTF-- -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["var"]=> @@ -37,6 +41,8 @@ object(Closure)#%d (2) { Closure Object ( [name] => {closure:%s:%d} + [file] => %s + [line] => %d [static] => Array ( [var] => @@ -44,9 +50,13 @@ Closure Object ) Undefined constant "CONST_REF" -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["var"]=> @@ -56,15 +66,21 @@ object(Closure)#%d (2) { Closure Object ( [name] => {closure:%s:%d} + [file] => %s + [line] => %d [static] => Array ( [var] => ) ) -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["var"]=> @@ -74,6 +90,8 @@ object(Closure)#%d (2) { Closure Object ( [name] => {closure:%s:%d} + [file] => %s + [line] => %d [static] => Array ( [var] => foo diff --git a/Zend/tests/bug81076.phpt b/Zend/tests/bug81076.phpt index 9bb7d48d39624..4230937417cdf 100644 --- a/Zend/tests/bug81076.phpt +++ b/Zend/tests/bug81076.phpt @@ -5,7 +5,11 @@ Bug #81076 Invalid implicit binds cause incorrect static var count in closure de var_dump(fn() => [$why, $do, $we, $count]); ?> --EXPECTF-- -object(Closure)#%d (1) { +object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } diff --git a/Zend/tests/call_user_func_003.phpt b/Zend/tests/call_user_func_003.phpt index 2ab46fff41a68..a38c3c93b1ede 100644 --- a/Zend/tests/call_user_func_003.phpt +++ b/Zend/tests/call_user_func_003.phpt @@ -21,15 +21,23 @@ var_dump(call_user_func(function() use (&$foo) { return $foo; }, '__invoke')); ?> --EXPECTF-- string(3) "OK!" -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["instance"]=> - object(Closure)#%d (1) { + object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } } } diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt index 4affcfec78e55..1cc080426a345 100644 --- a/Zend/tests/call_user_func_005.phpt +++ b/Zend/tests/call_user_func_005.phpt @@ -22,9 +22,13 @@ Deprecated: Optional parameter $a declared before required parameter $b is impli string(1) "x" array(1) { [0]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["parameter"]=> array(2) { ["$a"]=> diff --git a/Zend/tests/closure_020.phpt b/Zend/tests/closure_020.phpt index 2eb057ec9dee4..658a1a232e44f 100644 --- a/Zend/tests/closure_020.phpt +++ b/Zend/tests/closure_020.phpt @@ -28,9 +28,13 @@ object(foo)#%d (2) { ["test":"foo":private]=> int(3) ["a"]=> - object(Closure)#%d (3) { + object(Closure)#%d (5) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["a"]=> diff --git a/Zend/tests/closure_026.phpt b/Zend/tests/closure_026.phpt index 6eb7ee5c4d9da..99ce41201b5d8 100644 --- a/Zend/tests/closure_026.phpt +++ b/Zend/tests/closure_026.phpt @@ -33,9 +33,13 @@ object(foo)#%d (1) { ["a"]=> array(1) { [0]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["this"]=> *RECURSION* } @@ -46,9 +50,13 @@ int(1) string(1) "a" array(1) { [0]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["this"]=> object(foo)#%d (1) { ["a"]=> diff --git a/Zend/tests/closure_032.phpt b/Zend/tests/closure_032.phpt index 5d1577b5fcb93..1606b4c2466f6 100644 --- a/Zend/tests/closure_032.phpt +++ b/Zend/tests/closure_032.phpt @@ -54,6 +54,8 @@ Array [0] => Closure Object ( [name] => {closure:%s:%d} + [file] => %s + [line] => 8 [parameter] => Array ( [$param] => diff --git a/Zend/tests/closure_034.phpt b/Zend/tests/closure_034.phpt index f4db8970dbbf7..32d7fb03fca14 100644 --- a/Zend/tests/closure_034.phpt +++ b/Zend/tests/closure_034.phpt @@ -8,9 +8,13 @@ var_dump($a); ?> --EXPECTF-- -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["a"]=> diff --git a/Zend/tests/closure_035.phpt b/Zend/tests/closure_035.phpt index 88df9c408b1ad..d72fe7f0fab67 100644 --- a/Zend/tests/closure_035.phpt +++ b/Zend/tests/closure_035.phpt @@ -15,9 +15,13 @@ var_dump($x()); ?> --EXPECTF-- -object(Closure)#%d (2) { +object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["x"]=> diff --git a/Zend/tests/closure_065.phpt b/Zend/tests/closure_065.phpt index 4be0a8bd128df..04db2a6b6899c 100644 --- a/Zend/tests/closure_065.phpt +++ b/Zend/tests/closure_065.phpt @@ -5,9 +5,13 @@ Dumping closures includes the name. var_dump(function($foo) { }); ?> --EXPECTF-- -object(Closure)#1 (2) { +object(Closure)#1 (4) { ["name"]=> string(%d) "{closure:%s:2}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["parameter"]=> array(1) { ["$foo"]=> diff --git a/Zend/tests/return_types/011.phpt b/Zend/tests/return_types/011.phpt index b1aa49a3d221b..e63a1e5e034ba 100644 --- a/Zend/tests/return_types/011.phpt +++ b/Zend/tests/return_types/011.phpt @@ -12,4 +12,8 @@ var_dump(foo()); object(Closure)#%d (%d) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } diff --git a/Zend/tests/return_types/012.phpt b/Zend/tests/return_types/012.phpt index f12809d3dfa23..8548883049802 100644 --- a/Zend/tests/return_types/012.phpt +++ b/Zend/tests/return_types/012.phpt @@ -15,9 +15,13 @@ $baz = new foo(); var_dump($baz->bar()); ?> --EXPECTF-- -object(Closure)#%d (3) { +object(Closure)#%d (5) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["static"]=> array(1) { ["test"]=> diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt index 75a7fab5fd17e..c72cb4f75aec7 100644 --- a/Zend/tests/type_declarations/callable_001.phpt +++ b/Zend/tests/type_declarations/callable_001.phpt @@ -21,9 +21,13 @@ foo(array("bar", "baz")); --EXPECTF-- string(6) "strpos" string(3) "foo" -object(Closure)#%d (1) { +object(Closure)#%d (3) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } array(2) { [0]=> diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index c805818a165c1..ec75179956e20 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -606,6 +606,12 @@ static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) } else { ZVAL_STR_COPY(&val, closure->func.common.function_name); zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_NAME), &val); + + ZVAL_STR_COPY(&val, closure->func.op_array.filename); + zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_FILE), &val); + + ZVAL_LONG(&val, closure->func.op_array.line_start); + zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_LINE), &val); } if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { diff --git a/ext/spl/tests/bug71236.phpt b/ext/spl/tests/bug71236.phpt index f44c621700298..a499e62e25911 100644 --- a/ext/spl/tests/bug71236.phpt +++ b/ext/spl/tests/bug71236.phpt @@ -11,9 +11,13 @@ var_dump(spl_autoload_functions()); --EXPECTF-- array(2) { [0]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["parameter"]=> array(1) { ["$class"]=> diff --git a/ext/spl/tests/spl_autoload_013.phpt b/ext/spl/tests/spl_autoload_013.phpt index 9e722c8a01de3..b9b6f6571f320 100644 --- a/ext/spl/tests/spl_autoload_013.phpt +++ b/ext/spl/tests/spl_autoload_013.phpt @@ -29,9 +29,13 @@ var_dump(spl_autoload_functions()); --EXPECTF-- array(3) { [0]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["parameter"]=> array(1) { ["$class"]=> diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index c96f92dcb54a2..c6ab3da4e964a 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -232,9 +232,13 @@ array(2) { int(3) } [1]=> - object(Closure)#%d (2) { + object(Closure)#%d (4) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["parameter"]=> array(2) { ["$v"]=> From 9152d69b115c65992d7e5222fdfcfae4693ebec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 18 Mar 2024 08:39:49 +0100 Subject: [PATCH 07/13] Fix test --- ext/opcache/tests/jit/closure_001.phpt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ext/opcache/tests/jit/closure_001.phpt b/ext/opcache/tests/jit/closure_001.phpt index baede7bd1ffa4..59d68f1a58d86 100644 --- a/ext/opcache/tests/jit/closure_001.phpt +++ b/ext/opcache/tests/jit/closure_001.phpt @@ -34,6 +34,10 @@ var_dump($f()); object(Closure)#3 (2) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["this"]=> object(Foo)#1 (0) { } @@ -41,6 +45,10 @@ object(Closure)#3 (2) { object(Closure)#3 (2) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) ["this"]=> object(Foo)#1 (0) { } @@ -48,4 +56,8 @@ object(Closure)#3 (2) { object(Closure)#3 (1) { ["name"]=> string(%d) "{closure:%s:%d}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) } From e30ec588e82231a3ac2edd0d4da5749c011d7799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 18 Mar 2024 10:24:45 +0100 Subject: [PATCH 08/13] Fix test --- ext/opcache/tests/jit/closure_001.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/opcache/tests/jit/closure_001.phpt b/ext/opcache/tests/jit/closure_001.phpt index 59d68f1a58d86..7dd94b51761a2 100644 --- a/ext/opcache/tests/jit/closure_001.phpt +++ b/ext/opcache/tests/jit/closure_001.phpt @@ -31,7 +31,7 @@ var_dump($f->call($foo)); var_dump($f()); ?> --EXPECTF-- -object(Closure)#3 (2) { +object(Closure)#3 (4) { ["name"]=> string(%d) "{closure:%s:%d}" ["file"]=> @@ -42,7 +42,7 @@ object(Closure)#3 (2) { object(Foo)#1 (0) { } } -object(Closure)#3 (2) { +object(Closure)#3 (4) { ["name"]=> string(%d) "{closure:%s:%d}" ["file"]=> @@ -53,7 +53,7 @@ object(Closure)#3 (2) { object(Foo)#1 (0) { } } -object(Closure)#3 (1) { +object(Closure)#3 (3) { ["name"]=> string(%d) "{closure:%s:%d}" ["file"]=> From f2814149279519b503c3d69570feaee6a00a5950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 18 Mar 2024 14:00:34 +0100 Subject: [PATCH 09/13] Include the surrounding class and function name in closure names --- Zend/tests/closure_065.phpt | 98 +++++++++++++++++++++++++++++++------ Zend/tests/closure_066.phpt | 20 ++++++++ Zend/zend_compile.c | 35 ++++++++++++- 3 files changed, 137 insertions(+), 16 deletions(-) create mode 100644 Zend/tests/closure_066.phpt diff --git a/Zend/tests/closure_065.phpt b/Zend/tests/closure_065.phpt index 04db2a6b6899c..3fcbf496f6a60 100644 --- a/Zend/tests/closure_065.phpt +++ b/Zend/tests/closure_065.phpt @@ -1,20 +1,88 @@ --TEST-- -Dumping closures includes the name. +The closure name includes the source location (2) --FILE-- name); + } + + public function nestedClosure() { + $c = function () { + $c = function () { + $c = function () {}; + $r = new \ReflectionFunction($c); + var_dump($r->name); + }; + + $c(); + }; + + $c(); + } + } + + function function_name() { + $c = function () { }; + $r = new \ReflectionFunction($c); + var_dump($r->name); + } +} + +namespace { + class ClassName { + public function methodName() { + $c = function () {}; + $r = new \ReflectionFunction($c); + var_dump($r->name); + } + + public function nestedClosure() { + $c = function () { + $c = function () { + $c = function () {}; + $r = new \ReflectionFunction($c); + var_dump($r->name); + }; + + $c(); + }; + + $c(); + } + } + + function function_name() { + $c = function () { }; + $r = new \ReflectionFunction($c); + var_dump($r->name); + } + + $class = new \NameSpaceName\ClassName(); + $class->methodName(); + $class->nestedClosure(); + \NameSpaceName\function_name(); + + $class = new \ClassName(); + $class->methodName(); + $class->nestedClosure(); + \function_name(); + + $c = function () { }; + $r = new \ReflectionFunction($c); + var_dump($r->name); +} + ?> --EXPECTF-- -object(Closure)#1 (4) { - ["name"]=> - string(%d) "{closure:%s:2}" - ["file"]=> - string(%d) "%s" - ["line"]=> - int(%d) - ["parameter"]=> - array(1) { - ["$foo"]=> - string(10) "" - } -} +string(49) "{closure:NameSpaceName\ClassName::methodName():6}" +string(79) "{closure:{closure:{closure:NameSpaceName\ClassName::nestedClosure():12}:13}:14}" +string(42) "{closure:NameSpaceName\function_name():27}" +string(36) "{closure:ClassName::methodName():36}" +string(65) "{closure:{closure:{closure:ClassName::nestedClosure():42}:43}:44}" +string(28) "{closure:function_name():57}" +string(71) "{closure:%sclosure_%d.php:72}" diff --git a/Zend/tests/closure_066.phpt b/Zend/tests/closure_066.phpt new file mode 100644 index 0000000000000..04db2a6b6899c --- /dev/null +++ b/Zend/tests/closure_066.phpt @@ -0,0 +1,20 @@ +--TEST-- +Dumping closures includes the name. +--FILE-- + +--EXPECTF-- +object(Closure)#1 (4) { + ["name"]=> + string(%d) "{closure:%s:2}" + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) + ["parameter"]=> + array(1) { + ["$foo"]=> + string(10) "" + } +} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 400a14bfa6188..8e0025ce54fbf 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7668,7 +7668,40 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, if (op_array->fn_flags & ZEND_ACC_CLOSURE) { zend_string *filename = op_array->filename; uint32_t start_lineno = decl->start_lineno; - op_array->function_name = name = unqualified_name = zend_strpprintf(0, "{closure:%s:%" PRIu32 "}", ZSTR_VAL(filename), start_lineno); + + zend_string *class = zend_empty_string; + zend_string *separator = zend_empty_string; + zend_string *function = filename; + char *parens = ""; + + if (CG(active_op_array) && CG(active_op_array)->function_name) { + if (CG(active_op_array)->fn_flags & ZEND_ACC_CLOSURE) { + /* If the parent function is a closure, don't redundantly + * add the classname and parentheses. + */ + function = CG(active_op_array)->function_name; + } else { + function = CG(active_op_array)->function_name; + parens = "()"; + + if (CG(active_class_entry) && CG(active_class_entry)->name) { + class = CG(active_class_entry)->name; + separator = ZSTR_KNOWN(ZEND_STR_PAAMAYIM_NEKUDOTAYIM); + } + } + } + + unqualified_name = zend_strpprintf_unchecked( + 0, + "{closure:%S%S%S%s:%" PRIu32 "}", + class, + separator, + function, + parens, + start_lineno + ); + + op_array->function_name = name = unqualified_name; } else { unqualified_name = decl->name; op_array->function_name = name = zend_prefix_with_ns(unqualified_name); From 0558b947fb3cdfffcb7ea0494c77b2accf0795a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 18 Mar 2024 16:12:00 +0100 Subject: [PATCH 10/13] Fix test --- Zend/tests/closure_065.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/closure_065.phpt b/Zend/tests/closure_065.phpt index 3fcbf496f6a60..2f03dbdbc4c90 100644 --- a/Zend/tests/closure_065.phpt +++ b/Zend/tests/closure_065.phpt @@ -85,4 +85,4 @@ string(42) "{closure:NameSpaceName\function_name():27}" string(36) "{closure:ClassName::methodName():36}" string(65) "{closure:{closure:{closure:ClassName::nestedClosure():42}:43}:44}" string(28) "{closure:function_name():57}" -string(71) "{closure:%sclosure_%d.php:72}" +string(%d) "{closure:%sclosure_%d.php:72}" From b4efdd40436bb1ed08e21c9ccca129060186e003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 12 Apr 2024 17:01:58 +0200 Subject: [PATCH 11/13] Relax test expecations --- Zend/tests/match/029.phpt | 2 +- Zend/tests/match/030.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/tests/match/029.phpt b/Zend/tests/match/029.phpt index a6103df05fd64..8ac60479a2f8e 100644 --- a/Zend/tests/match/029.phpt +++ b/Zend/tests/match/029.phpt @@ -18,6 +18,6 @@ echo "unreachable\n"; --EXPECTF-- Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s029.php:4 Stack trace: -#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 7) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', %d) #1 {main} thrown in %s029.php on line 4 diff --git a/Zend/tests/match/030.phpt b/Zend/tests/match/030.phpt index feeaa1c49ca02..7555a5b129b01 100644 --- a/Zend/tests/match/030.phpt +++ b/Zend/tests/match/030.phpt @@ -18,6 +18,6 @@ echo "unreachable\n"; --EXPECTF-- Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s030.php:4 Stack trace: -#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', 7) +#0 %s(%d): {closure:%s:%d}(2, 'Undefined varia...', '%s', %d) #1 {main} thrown in %s030.php on line 4 From 350c48e4ab37831116539128d313e5670a0ca103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 12 Apr 2024 17:05:58 +0200 Subject: [PATCH 12/13] Fix tests after merge --- Zend/tests/call_user_func_005.phpt | 2 +- Zend/tests/ns_073.phpt | 2 +- sapi/phpdbg/tests/gh13827.phpt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt index 4495dfa03b8ad..ea79e149f27a3 100644 --- a/Zend/tests/call_user_func_005.phpt +++ b/Zend/tests/call_user_func_005.phpt @@ -18,7 +18,7 @@ var_dump(call_user_func(array('foo', 'teste'))); ?> --EXPECTF-- -Deprecated: {closure}(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d +Deprecated: {closure:%s:%d}(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d string(1) "x" array(1) { [0]=> diff --git a/Zend/tests/ns_073.phpt b/Zend/tests/ns_073.phpt index c2bacc858e807..86385ca6f9e8f 100644 --- a/Zend/tests/ns_073.phpt +++ b/Zend/tests/ns_073.phpt @@ -14,7 +14,7 @@ $x(new \stdclass); ?> --EXPECTF-- -Deprecated: foo\{closure}(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d +Deprecated: {closure:%s:%d}(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d NULL object(stdClass)#%d (0) { } diff --git a/sapi/phpdbg/tests/gh13827.phpt b/sapi/phpdbg/tests/gh13827.phpt index 3d7017bf309f5..4d699b32e521a 100644 --- a/sapi/phpdbg/tests/gh13827.phpt +++ b/sapi/phpdbg/tests/gh13827.phpt @@ -25,6 +25,6 @@ prompt> [Uncaught GracefulExit in on line 0: ] >00006: Fiber::suspend(); 00007: }); 00008: -prompt> frame #0: {closure}() at %s:6 - => {closure} (internal function) +prompt> frame #0: {closure:%s:%d}() at %s:6 + => {closure:%s:%d} (internal function) prompt> From 6c920fddaed50ad8f117de78475ed03d61268aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 12 Apr 2024 17:09:26 +0200 Subject: [PATCH 13/13] NEWS / UPGRADING --- NEWS | 1 + UPGRADING | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 6fcb6b9a92a56..b687b68242c27 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ PHP NEWS . Added sparc64 arch assembly support for zend fiber. (Claudio Jeker) . Fixed GH-13581 no space available for TLS on NetBSD. (Paul Ripke) . Added fiber Sys-V loongarch64 support. (qiangxuhui) + . Adjusted closure names to include the parent function's name. (timwolla) - Curl: . Deprecated the CURLOPT_BINARYTRANSFER constant. (divinity76) diff --git a/UPGRADING b/UPGRADING index 39aafa82aa410..19e41afc3efad 100644 --- a/UPGRADING +++ b/UPGRADING @@ -172,6 +172,8 @@ PHP 8.4 UPGRADE NOTES RFC: https://wiki.php.net/rfc/rfc1867-non-post . Getting the debug info for WeakReference will now also output the object it references, or null if the reference is no longer valid. + . The output of Closure::__debugInfo() now includes the name, file, and line + of the Closure. - Curl: . curl_version() returns an additional feature_list value, which is an @@ -620,6 +622,10 @@ PHP 8.4 UPGRADE NOTES 13. Other Changes ======================================== +* Closure names have been adjusted to include the parent function's name + and the line of definition to make them easier to distinguish, for example + within stack traces. + ======================================== 14. Performance Improvements ========================================