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