Skip to content

Commit b2a5316

Browse files
gbalduzzibshaffer
authored andcommitted
Add the proper Exception message for all JSON error types by PHP (#110)
1 parent d2c50fd commit b2a5316

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/JWT.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,10 @@ private static function handleJsonError($errno)
352352
{
353353
$messages = array(
354354
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
355+
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
355356
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
356-
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
357+
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
358+
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3
357359
);
358360
throw new DomainException(
359361
isset($messages[$errno])

0 commit comments

Comments
 (0)