1--TEST--
2Test array_sum() function with objects that implement addition but not castable to numeric type
3--EXTENSIONS--
4ffi
5--FILE--
6<?php
7
8$x = FFI::cdef()->new("int[2]");
9$x[0] = 10;
10$x[1] = 25;
11
12$input = [$x, 1];
13
14echo "array_sum() version:\n";
15var_dump(array_sum($input));
16
17echo "array_reduce() version:\n";
18var_dump(array_reduce($input, fn($carry, $value) => $carry + $value, 0));
19?>
20--EXPECTF--
21array_sum() version:
22
23Warning: array_sum(): Addition is not supported on type FFI\CData in %s on line %d
24int(1)
25array_reduce() version:
26object(FFI\CData:int32_t*)#4 (1) {
27  [0]=>
28  int(25)
29}
30