You are here

private static function JWT::handleJsonError in Auth0 Single Sign On 8.2

Helper method to create a JSON error.

Parameters

int $errno An error number from json_last_error():

Return value

void

2 calls to JWT::handleJsonError()
JWT::jsonDecode in vendor/firebase/php-jwt/src/JWT.php
Decode a JSON string into a PHP object.
JWT::jsonEncode in vendor/firebase/php-jwt/src/JWT.php
Encode a PHP object into a JSON string.

File

vendor/firebase/php-jwt/src/JWT.php, line 362

Class

JWT
JSON Web Token implementation, based on this spec: https://tools.ietf.org/html/rfc7519

Namespace

Firebase\JWT

Code

private static function handleJsonError($errno) {
  $messages = array(
    JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
    JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
    JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
    JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
    JSON_ERROR_UTF8 => 'Malformed UTF-8 characters',
  );
  throw new DomainException(isset($messages[$errno]) ? $messages[$errno] : 'Unknown JSON error: ' . $errno);
}