summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiorgio Balduzzi <gio.balduz@gmail.com>2017-06-21 22:57:21 +0200
committerBrent Shaffer <betterbrent@google.com>2017-06-21 13:57:21 -0700
commitb2a53166f9e2d8958be837e1b368c0897fc52a77 (patch)
tree48b48b5c6cc84aca4fa5848497fce58fa31394be /src
parentd2c50fdaedaa64f91229c30fa4190b0113847b45 (diff)
downloadphp-jwt-b2a53166f9e2d8958be837e1b368c0897fc52a77.zip
php-jwt-b2a53166f9e2d8958be837e1b368c0897fc52a77.tar.gz
php-jwt-b2a53166f9e2d8958be837e1b368c0897fc52a77.tar.bz2
Add the proper Exception message for all JSON error types by PHP (#110)
Diffstat (limited to 'src')
-rw-r--r--src/JWT.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/JWT.php b/src/JWT.php
index 7729143..814afc0 100644
--- a/src/JWT.php
+++ b/src/JWT.php
@@ -352,8 +352,10 @@ class JWT
{
$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])