{"record":{"id":"148e216426d429ed","repo":"octobercms/october","slug":"attribute-name-cannot-be-empty-for-148e21","errorCode":null,"errorMessage":"Attribute name cannot be empty for ","messagePattern":"Attribute name cannot be empty for ","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/dashboard/classes/ReportDimensionFilter.php","lineNumber":52,"sourceCode":"     * @param ?string $attributeName Specifies the attribute name, e.g. a dimension field code.\n     * Must not be null if the data attribute type is ATTR_TYPE_DIMENSION_FIELD.\n     * Must be null if the data attribute type is ATTR_TYPE_DIMENSION.\n     * @param bool $operation Specifies the filter operation.\n     * One of the OPERATION_* constants.\n     * @param string|array|int|float|bool $value Specifies the filter value.\n     */\n    public function __construct(string $dataAttributeType, ?string $attributeName, string $operation, string|array|int|float|bool $value)\n    {\n        $knownAttributeTypes = [\n            self::ATTR_TYPE_DIMENSION,\n            self::ATTR_TYPE_DIMENSION_FIELD\n        ];\n        if (!in_array($dataAttributeType, $knownAttributeTypes)) {\n            throw new SystemException('Invalid data attribute type. Supported types: ' . implode(', ', $knownAttributeTypes));\n        }\n\n        if (!strlen($attributeName) && $dataAttributeType !== self::ATTR_TYPE_DIMENSION) {\n            throw new SystemException('Attribute name cannot be empty for ' . $dataAttributeType . ' data attribute type.');\n        }\n\n        if (strlen($attributeName) && $dataAttributeType === self::ATTR_TYPE_DIMENSION) {\n            throw new SystemException('Attribute name must be empty for ' . self::ATTR_TYPE_DIMENSION . ' data attribute type.');\n        }\n\n        if ($dataAttributeType === self::ATTR_TYPE_DIMENSION_FIELD) {\n            ReportDimensionField::validateCode($attributeName);\n        }\n\n        $knownOperations = [\n            self::OPERATION_EQUALS,\n            self::OPERATION_MORE_OR_EQUALS,\n            self::OPERATION_LESS_OR_EQUALS,\n            self::OPERATION_MORE,\n            self::OPERATION_LESS,\n            self::OPERATION_STARTS_WITH,\n            self::OPERATION_STRING_INCLUDES,","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/dashboard/classes/ReportDimensionFilter.php#L34-L70","documentation":"A filter of type ATTR_TYPE_DIMENSION_FIELD targets a specific field of a dimension, so the constructor requires a non-empty $attributeName carrying that field's code. Passing null or '' with a non-dimension type throws a SystemException.","triggerScenarios":"new ReportDimensionFilter(ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD, null, ReportDimensionFilter::OPERATION_EQUALS, 'active') or with '' as the second argument.","commonSituations":"Building filters from request arrays where the attribute key is missing (null coalescing to null); copy-paste of a dimension-type filter without adding the field code; front-ends that omit the field selector when the user did not pick one.","solutions":["Supply the dimension field code as the attribute name, e.g. 'oc_field_status'","If the intent is to filter the dimension column itself, use ATTR_TYPE_DIMENSION with a null attribute name instead","Validate that the incoming payload contains a non-empty attribute before constructing the filter"],"exampleFix":"// before\n$filter = new ReportDimensionFilter(\n    ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,\n    $payload['attribute'] ?? null,\n    ReportDimensionFilter::OPERATION_EQUALS,\n    'active'\n);\n\n// after\nif (empty($payload['attribute'])) {\n    throw new InvalidArgumentException('attribute is required for dimension_field filters');\n}\n$filter = new ReportDimensionFilter(\n    ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD,\n    $payload['attribute'],\n    ReportDimensionFilter::OPERATION_EQUALS,\n    'active'\n);","handlingStrategy":"validation","validationCode":"$attribute = $payload['attribute'] ?? null;\nif ($type === ReportDimensionFilter::ATTR_TYPE_DIMENSION_FIELD && (!is_string($attribute) || $attribute === '')) {\n    throw new InvalidArgumentException('attribute is required for dimension_field filters');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair the type with its attribute rule in one factory: dimension => null, dimension_field => non-empty oc_field_ code","Reject filter payloads missing the attribute for field filters at the boundary","Remember the attribute for field filters must also pass the oc_field_ code validation"],"tags":["php","dashboard","report","filter","validation"],"backgroundTag":"missing-required-field","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}