{"record":{"id":"e7ea955bc42b0cd0","repo":"PHPOffice/PhpSpreadsheet","slug":"invalid-rule-connection-for-column-autofilter","errorCode":null,"errorMessage":"Invalid rule connection for column AutoFilter.","messagePattern":"Invalid rule connection for column AutoFilter\\.","errorType":"exception","errorClass":"PhpOffice\\PhpSpreadsheet\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php","lineNumber":201,"sourceCode":"    public function getJoin(): string\n    {\n        return $this->join;\n    }\n\n    /**\n     * Set AutoFilter Multiple Rules And/Or.\n     *\n     * @param string $join And/Or\n     *\n     * @return $this\n     */\n    public function setJoin(string $join): static\n    {\n        $this->setEvaluatedFalse();\n        // Lowercase And/Or\n        $join = strtolower($join);\n        if (!in_array($join, self::$ruleJoins)) {\n            throw new PhpSpreadsheetException('Invalid rule connection for column AutoFilter.');\n        }\n\n        $this->join = $join;\n\n        return $this;\n    }\n\n    /**\n     * Set AutoFilter Attributes.\n     *\n     * @param (float|int|string)[] $attributes\n     *\n     * @return $this\n     */\n    public function setAttributes(array $attributes): static\n    {\n        $this->setEvaluatedFalse();\n        $this->attributes = $attributes;","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/PHPOffice/PhpSpreadsheet/blob/65b080eef4d9fd11a5796135ab145883e5c3d6a6/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php#L183-L219","documentation":"Column::setJoin() lowercases the input and validates it against the allowed join words 'and' and 'or', which control how multiple custom-filter rules combine. Any other string is rejected.","triggerScenarios":"->setJoin('AND') works (it is lowercased), but ->setJoin('&'), ->setJoin('plus') or ->setJoin('') throws.","commonSituations":"Passing boolean connectors from other formats ('&&', 'AND ' with whitespace is trimmed? not trimmed) or user-supplied join words straight into the API.","solutions":["Pass only 'and' or 'or' (any case)","Normalize incoming data with strtolower() plus a whitelist check before calling setJoin()"],"exampleFix":"// before\n$column->setJoin($userJoin); // e.g. '&&'\n\n// after\n$join = strtolower($userJoin);\n$column->setJoin(in_array($join, ['and', 'or'], true) ? $join : 'and');","handlingStrategy":"validation","validationCode":"$join = strtolower($join);\nif (!in_array($join, ['and', 'or'], true)) {\n    $join = 'and';\n}\n$column->setJoin($join);","typeGuard":"function isValidRuleJoin(string $join): bool\n{\n    return in_array(strtolower($join), ['and', 'or'], true);\n}","tryCatchPattern":"try {\n    $column->setJoin($join);\n} catch (\\PhpOffice\\PhpSpreadsheet\\Exception $e) {\n    $column->setJoin('and');\n}","preventionTips":["Lowercase and whitelist join words at your input boundary","Never pass symbols like && or || as the join"],"tags":["autofilter","join","enum","validation","phpspreadsheet"],"backgroundTag":"invalid-enum-value","analyzedSha":"65b080eef4d9fd11a5796135ab145883e5c3d6a6","analyzedAt":"2026-08-17T05:40:41.646Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}