{"record":{"id":"a12a43a859878d77","repo":"phalcon/cphalcon","slug":"invalid-header-missing-typ-element","errorCode":null,"errorMessage":"Invalid Header (missing 'typ' element)","messagePattern":"Invalid Header \\(missing 'typ' element\\)","errorType":"exception","errorClass":"MissingJwtTypHeader","httpStatus":null,"severity":"error","filePath":"phalcon/Encryption/Security/JWT/Token/Parser.zep","lineNumber":117,"sourceCode":"    /**\n     * Decodes the headers\n     *\n     * @param string $headers\n     *\n     * @return Item\n     */\n    private function decodeHeaders(string headers) -> <Item>\n    {\n        var decoded;\n\n        let decoded = this->decode->__invoke(this->doDecodeUrl(headers), true);\n\n        if typeof decoded !== \"array\" {\n            throw new InvalidHeader();\n        }\n\n        if !isset decoded[Enum::TYPE] {\n            throw new MissingJwtTypHeader();\n        }\n\n        return new Item(decoded, headers);\n    }\n\n    /**\n     * Decodes the signature\n     *\n     * @param Item   $headers\n     * @param string $signature\n     *\n     * @return Signature\n     */\n    private function decodeSignature(<Item> headers,  string signature) -> <Signature>\n    {\n        var algo, decoded, encodedSignature;\n\n        let decoded          = \"\",","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Encryption/Security/JWT/Token/Parser.zep#L99-L135","documentation":"Raised in Token\\Parser::decodeHeaders when the decoded JWT header segment either is not a JSON array/object at all (InvalidHeader) or lacks the mandatory 'typ' element (MissingJwtTypHeader). The input at fault is the base64/URL-decoded header payload of the received token; a well-formed JWT header must include 'typ', so its absence means the token is malformed and cannot be parsed.","triggerScenarios":"Thrown at phalcon/Encryption/Security/JWT/Token/Parser.zep:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the issuing side includes a 'typ':'JWT' header when signing tokens","If integrating with a third-party issuer, wrap/normalize the header before parsing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}