%s is not supported on type %s

Description

This error is reported when an operation is attempted indirectly on a wrong type of data. Here, there is an attempt to add 3 values, one of which is an array.

Example

<?php

$array = [ 1, 2, [3]];
print array_sum($array);

$array = [ 1, 2, (object) [3]];
print array_product($array);

?>

Literal Examples

  • Addition is not supported on type array

  • Multiplication is not supported on type object

Solutions

  • Check that the array only contains numbers.