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
9opcache.optimization_level=0x7FFFBFFF & ~0x0080
10--FILE--
11<?php
12$bar = function() {
13    var_dump(array_sum([40,2]));
14};
15
16$foo = function($bar) {
17    echo 'Answer' . PHP_EOL;
18    $bar();
19};
20
21$foo($bar);
22$foo($bar);
23$foo($bar);
24
25echo 'DONE' . PHP_EOL;
26?>
27--EXPECTF--
28<!-- init '%s' -->
29<file '%s'>
30  <!-- init {closure}() -->
31  <{closure}>
32Answer
33    <!-- init {closure}() -->
34    <{closure}>
35      <!-- init array_sum() -->
36      <array_sum>
37      </array_sum>
38      <!-- init var_dump() -->
39      <var_dump>
40int(42)
41      </var_dump>
42    </{closure}>
43  </{closure}>
44  <{closure}>
45Answer
46    <{closure}>
47      <array_sum>
48      </array_sum>
49      <var_dump>
50int(42)
51      </var_dump>
52    </{closure}>
53  </{closure}>
54  <{closure}>
55Answer
56    <{closure}>
57      <array_sum>
58      </array_sum>
59      <var_dump>
60int(42)
61      </var_dump>
62    </{closure}>
63  </{closure}>
64DONE
65</file '%s'>
66