xref: /php-src/Zend/tests/closure_064.phpt (revision 08b2ab22)
1--TEST--
2The closure name includes the source location
3--FILE--
4<?php
5function get_closure3($c) {
6    return function () use ($c) {
7        return $c();
8    };
9}
10function throws() {
11    throw new \Exception();
12}
13$throws = throws(...);
14$closure1 = function() use ($throws) { $throws(); };
15$closure2 = fn () => $closure1();
16$closure3 = get_closure3($closure2);
17\array_map(
18    function ($item) use ($closure3) { $closure3(); },
19    [1]
20);
21?>
22--EXPECTF--
23Fatal error: Uncaught Exception in %s:8
24Stack trace:
25#0 %s(11): throws()
26#1 %s(12): {closure:%s:11}()
27#2 %s(4): {closure:%s:12}()
28#3 %s(15): {closure:%s:3}()
29#4 [internal function]: {closure:%s:15}(1)
30#5 %s(14): array_map(Object(Closure), Array)
31#6 {main}
32  thrown in %s on line 8
33