phalcon/cphalcon · error · InvalidNotBefore
Invalid Not Before
Error message
Invalid Not Before
What it means
Thrown by Builder::setNotBefore when the $timestamp passed for the 'nbf' claim is not a valid NumericDate value, so the not-before claim cannot be recorded on the token under construction. It is a precondition guard in the setter: any non-conforming timestamp aborts building the JWT before the claim is added.
Solutions
- Pass an integer unix timestamp >= now (e.g. time() + 60) for nbf
- Cast string timestamps from config to int before setting the claim
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at phalcon/Encryption/Security/JWT/Builder.zep:382 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/61b2767ee33fad8a.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Encryption/Security/JWT/Builder.zep:382
/**
* The "nbf" (not before) claim identifies the time before which the JWT
* MUST NOT be accepted for processing. The processing of the "nbf"
* claim requires that the current date/time MUST be after or equal to
* the not-before date/time listed in the "nbf" claim. Implementers MAY
* provide for some small leeway, usually no more than a few minutes, to
* account for clock skew. Its value MUST be a number containing a
* NumericDate value. Use of this claim is OPTIONAL.
*
* @param int $timestamp
*
* @return static
* @throws ValidatorException
*/
public function setNotBefore( int timestamp) -> <static>
{
if timestamp > time() {
throw new InvalidNotBefore();
}
return this->setClaim(Enum::NOT_BEFORE, timestamp);
}
/**
* @param string $passphrase
*
* @return static
* @throws ValidatorException
*/
public function setPassphrase( string passphrase) -> <static>
{
if !preg_match(
"/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[\W_]).{16,}$/",
passphrase
) {
throw new WeakPassphrase();View on GitHub (pinned to b7419de9cd)