1.2.1279. Unsupported Operand Types

This error is raised when trying to combine an array and a scalar value.

Always checks that the types are compatible with the planned operations. PHP detects this error at linting time, when using literal values. When static expression are involved, this error will appear at execution time.

<?php

const MY_ARRAY = 'error';

// This leads to the infamous "Unsupported operand types" error
$b = MY_ARRAY + array(3,4);

?>

See also PHP - Fatal error: Unsupported operand types [duplicate].

1.2.1279.1. Suggestions

  • Make sure all the planned operations are compatible with the type used.

1.2.1279.2. Specs

Short name

Structures/UnsupportedOperandTypes

Rulesets

All, Analyze, PHP recommendations

Exakat since

1.7.2

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

plus

Available in

Entreprise Edition, Exakat Cloud