summaryrefslogtreecommitdiff
path: root/ext/zend_test/tests/observer_zend_call_function_01.phpt
blob: 03d7287470c8340412fb4142b88708d68a421811 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--TEST--
Observer: Calls that go through zend_call_function are observed
--SKIPIF--
<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
--INI--
zend_test.observer.enabled=1
zend_test.observer.observe_all=1
--FILE--
<?php
function sum($carry, $item) {
    $carry += $item;
    return $carry;
}

$a = [1, 2, 3, 4, 5];
// array_reduce() calls zend_call_function() under the hood
var_dump(array_reduce($a, 'sum'));
echo 'Done' . PHP_EOL;
?>
--EXPECTF--
<!-- init '%s/observer_zend_call_function_%d.php' -->
<file '%s/observer_zend_call_function_%d.php'>
  <!-- init sum() -->
  <sum>
  </sum>
  <sum>
  </sum>
  <sum>
  </sum>
  <sum>
  </sum>
  <sum>
  </sum>
int(15)
Done
</file '%s/observer_zend_call_function_%d.php'>