1--TEST--
2Observer: Basic observability of closures
3--SKIPIF--
4<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
5--INI--
6zend_test.observer.enabled=1
7zend_test.observer.observe_all=1
8--FILE--
9<?php
10$bar = function() {
11    var_dump(array_sum([40,2]));
12};
13
14$foo = function($bar) {
15    echo 'Answer' . PHP_EOL;
16    $bar();
17};
18
19$foo($bar);
20$foo($bar);
21$foo($bar);
22
23echo 'DONE' . PHP_EOL;
24?>
25--EXPECTF--
26<!-- init '%s%eobserver_closure_%d.php' -->
27<file '%s%eobserver_closure_%d.php'>
28  <!-- init {closure}() -->
29  <{closure}>
30Answer
31    <!-- init {closure}() -->
32    <{closure}>
33int(42)
34    </{closure}>
35  </{closure}>
36  <{closure}>
37Answer
38    <{closure}>
39int(42)
40    </{closure}>
41  </{closure}>
42  <{closure}>
43Answer
44    <{closure}>
45int(42)
46    </{closure}>
47  </{closure}>
48DONE
49</file '%s%eobserver_closure_%d.php'>
50