Skip to content

Commit

Permalink
Add the proper Exception message for all JSON error types by PHP (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalduzzi authored and bshaffer committed Jun 21, 2017
1 parent d2c50fd commit b2a5316
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/JWT.php
Expand Up @@ -352,8 +352,10 @@ 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_SYNTAX => 'Syntax error, malformed JSON',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3
);
throw new DomainException(
isset($messages[$errno])
Expand Down

0 comments on commit b2a5316

Please sign in to comment.