1--TEST--
2Observer: Basic observability of closures
3--EXTENSIONS--
4zend_test
5--INI--
6zend_test.observer.enabled=1
7zend_test.observer.show_output=1
8zend_test.observer.observe_all=1
9--FILE--
10<?php
11$bar = function() {
12    var_dump(array_sum([40,2]));
13};
14
15$foo = function($bar) {
16    echo 'Answer' . PHP_EOL;
17    $bar();
18};
19
20$foo($bar);
21$foo($bar);
22$foo($bar);
23
24echo 'DONE' . PHP_EOL;
25?>
26--EXPECTF--
27<!-- init '%s' -->
28<file '%s'>
29  <!-- init {closure}() -->
30  <{closure}>
31Answer
32    <!-- init {closure}() -->
33    <{closure}>
34      <!-- init array_sum() -->
35      <array_sum>
36      </array_sum>
37      <!-- init var_dump() -->
38      <var_dump>
39int(42)
40      </var_dump>
41    </{closure}>
42  </{closure}>
43  <{closure}>
44Answer
45    <{closure}>
46      <array_sum>
47      </array_sum>
48      <var_dump>
49int(42)
50      </var_dump>
51    </{closure}>
52  </{closure}>
53  <{closure}>
54Answer
55    <{closure}>
56      <array_sum>
57      </array_sum>
58      <var_dump>
59int(42)
60      </var_dump>
61    </{closure}>
62  </{closure}>
63DONE
64</file '%s'>
65