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:%s:%d}() -->
31  <{closure:%s:%d}>
32Answer
33    <!-- init {closure:%s:%d}() -->
34    <{closure:%s:%d}>
35      <!-- init array_sum() -->
36      <array_sum>
37      </array_sum>
38      <!-- init var_dump() -->
39      <var_dump>
40int(42)
41      </var_dump>
42    </{closure:%s:%d}>
43  </{closure:%s:%d}>
44  <{closure:%s:%d}>
45Answer
46    <{closure:%s:%d}>
47      <array_sum>
48      </array_sum>
49      <var_dump>
50int(42)
51      </var_dump>
52    </{closure:%s:%d}>
53  </{closure:%s:%d}>
54  <{closure:%s:%d}>
55Answer
56    <{closure:%s:%d}>
57      <array_sum>
58      </array_sum>
59      <var_dump>
60int(42)
61      </var_dump>
62    </{closure:%s:%d}>
63  </{closure:%s:%d}>
64DONE
65</file '%s'>
66