phalcon/cphalcon · error · MalformedJwtString

Invalid JWT string (dots misalignment)

Error message

Invalid JWT string (dots misalignment)

What it means

Thrown by JWT Token Parser::parseToken when splitting the token on '.' does not produce exactly three parts (header, claims, signature). The string is not a structurally valid JWT. Ensure the token has the three dot-separated segments.

Solutions

  1. Pass a compact-serialized JWT with exactly two dots delimiting three base64url segments
  2. Reject the input string early if it does not match the JWT shape
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Encryption/Security/JWT/Token/Parser.zep:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/e0f8b1371f727079. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Encryption/Security/JWT/Token/Parser.zep:161

        return new Signature(decoded, encodedSignature);
    }

    /**
     * Splits the token to its three parts;
     *
     * @param string $token
     *
     * @return array
     */
    private function parseToken( string token) -> array
    {
        var parts;

        let parts = explode(".", token);

        if count(parts) !== 3 {
            throw new MalformedJwtString();
        }

        return parts;
    }

}

View on GitHub (pinned to b7419de9cd)