{"record":{"id":"21ecb45442d98683","repo":"phalcon/cphalcon","slug":"audience-must-be-a-string-or-an-array","errorCode":null,"errorMessage":"Audience must be a string or an array","messagePattern":"Audience must be a string or an array","errorType":"exception","errorClass":"InvalidAudienceType","httpStatus":null,"severity":"error","filePath":"phalcon/Encryption/Security/JWT/Validator.zep","lineNumber":172,"sourceCode":"        }\n\n        return this;\n    }\n\n    /**\n     * Validate the audience\n     *\n     * @param string|array $audience\n     *\n     * @return static\n     * @throws ValidatorException\n     */\n    public function validateAudience(var audience) -> <static>\n    {\n        var item, tokenAudience;\n\n        if (typeof audience !== \"string\" && typeof audience !== \"array\") {\n            throw new InvalidAudienceType();\n        }\n\n        if (typeof audience === \"string\") {\n            let audience = [audience];\n        }\n\n        let tokenAudience = this->token->getClaims()->get(Enum::AUDIENCE, []);\n\n        for item in audience {\n            if (true !== in_array(item, tokenAudience)) {\n                let this->errors[] = \"Validation: audience not allowed\";\n            }\n        }\n\n        return this;\n    }\n\n    /**","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Encryption/Security/JWT/Validator.zep#L154-L190","documentation":"Error \"Audience must be a string or an array\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Encryption/Security/JWT/Validator.zep:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}