1--TEST--
2Test array_product() 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), new DoOperationNoCast(10)];
8
9echo "array_product() version:\n";
10var_dump(array_product($input));
11
12echo "array_reduce() version:\n";
13var_dump(array_reduce($input, fn($carry, $value) => $carry * $value, 1));
14?>
15--EXPECTF--
16array_product() version:
17
18Warning: array_product(): Multiplication is not supported on type DoOperationNoCast in %s on line %d
19
20Warning: array_product(): Multiplication is not supported on type DoOperationNoCast in %s on line %d
21
22Warning: array_product(): Multiplication is not supported on type DoOperationNoCast in %s on line %d
23int(1)
24array_reduce() version:
25object(DoOperationNoCast)#5 (1) {
26  ["val":"DoOperationNoCast":private]=>
27  int(1500)
28}
29