octobercms/october · error · SystemException

Value must be of type array for

Error message

Value must be of type array for 

What it means

The OPERATION_ONE_OF filter matches a set of values, so its $value must be an array. The constructor throws when one_of is combined with a scalar, boolean, or any non-array value.

Source

Thrown at modules/dashboard/classes/ReportDimensionFilter.php:79

        }

        $knownOperations = [
            self::OPERATION_EQUALS,
            self::OPERATION_MORE_OR_EQUALS,
            self::OPERATION_LESS_OR_EQUALS,
            self::OPERATION_MORE,
            self::OPERATION_LESS,
            self::OPERATION_STARTS_WITH,
            self::OPERATION_STRING_INCLUDES,
            self::OPERATION_ONE_OF
        ];

        if (!in_array($operation, $knownOperations)) {
            throw new SystemException('Invalid filter operation. Supported types: ' . implode(', ', $knownOperations));
        }

        if ($operation === self::OPERATION_ONE_OF && !is_array($value)) {
            throw new SystemException('Value must be of type array for ' . self::OPERATION_ONE_OF . ' operation.');
        } elseif ($operation !== self::OPERATION_ONE_OF && is_array($value)) {
            throw new SystemException('Value cannot be of type array for ' . $operation . ' operation.');
        }

        $this->dataAttributeType = $dataAttributeType;
        $this->attributeName = $attributeName;
        $this->operation = $operation;
        $this->value = $value;
    }

    /**
     * Get the data attribute type
     *
     * @return string
     */
    public function getDataAttributeType(): string
    {
        return $this->dataAttributeType;

View on GitHub (pinned to b608633a7e)

Solutions

  1. Wrap single values in an array: ['active'] instead of 'active'
  2. Explode comma-separated input before constructing: array_map('trim', explode(',', $value))
  3. Ensure multi-select UI controls always submit arrays (even with one selection)

Example fix

// before
$filter = new ReportDimensionFilter(
    ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,
    'oc_field_status',
    ReportDimensionFilter::OPERATION_ONE_OF,
    'active'
);

// after
$filter = new ReportDimensionFilter(
    ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,
    'oc_field_status',
    ReportDimensionFilter::OPERATION_ONE_OF,
    ['active']
);
Defensive patterns

Strategy: validation

Validate before calling

if ($operation === ReportDimensionFilter::OPERATION_ONE_OF && !is_array($value)) {
    $value = is_string($value) && str_contains($value, ',')
        ? array_map('trim', explode(',', $value))
        : [$value];
}
$filter = new ReportDimensionFilter($type, $attribute, $operation, $value);

Type guard

function filterValueMatchesOperation(string $operation, mixed $value): bool
{
    return $operation === ReportDimensionFilter::OPERATION_ONE_OF
        ? is_array($value)
        : !is_array($value);
}

Prevention

When it happens

Trigger: new ReportDimensionFilter(ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD, 'oc_field_status', ReportDimensionFilter::OPERATION_ONE_OF, 'active') — a single scalar where an array is required.

Common situations: Front-ends sending a single selected value instead of a list for multi-select controls; request payloads where the value is a string of comma-separated items that was never exploded.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/d0d74e32f2654d45. Report an issue: GitHub.