3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class JWT { /** * Decodes a JWT string into a PHP object. * * @param string $jwt The JWT * @param string|null $key The secret key * @param bool $verify Don't skip verification process * * @throws UnexpectedValueException Provided JWT was invalid * @throws DomainException Algorithm was not provided * * @return object The JWT's payload as a PHP object * * @uses jsonDecode * @uses urlsafeB64Decode */ public static function decode($jwt, $key = null, $verify = true) { $tks = explode('.', $jwt); if (count($tks) != 3) { throw new \UnexpectedValueException('Wrong number of segments'); } list($headb64, $bodyb64, $cryptob64) = $tks; if (null === ($header = self::jsonDecode(self::urlsafeB64Decode($headb64)))) { throw new \UnexpectedValueException('Invalid segment encoding'); } if (null === $payload = self::jsonDecode(self::urlsafeB64Decode($bodyb64))) { throw new \UnexpectedValueException('Invalid segment encoding'); } $sig = self::urlsafeB64Decode($cryptob64); if ($verify) { if (empty($header->alg)) { throw new \DomainException('Empty algorithm'); } if ($sig != self::sign("$headb64.$bodyb64", $key, $header->alg)) { throw new \UnexpectedValueException('Signature verification failed'); } } return $payload; } /** * Converts and signs a PHP object or array into a JWT string. * * @param object|array $payload PHP object or array * @param string $key The secret key * @param string $algo The signing algorithm. Supported * algorithms are 'HS256', 'HS384' and 'HS512' * * @return string A signed JWT * * @uses jsonEncode * @uses urlsafeB64Encode */ public static function encode($payload, $key, $algo = 'HS256') { $header = ['typ' => 'JWT', 'alg' => $algo]; $segments = []; $segments[] = self::urlsafeB64Encode(self::jsonEncode($header)); $segments[] = self::urlsafeB64Encode(self::jsonEncode($payload)); $signing_input = implode('.', $segments); $signature = self::sign($signing_input, $key, $algo); $segments[] = self::urlsafeB64Encode($signature); return implode('.', $segments); } /** * Sign a string with a given key and algorithm. * * @param string $msg The message to sign * @param string $key The secret key * @param string $method The signing algorithm. Supported * algorithms are 'HS256', 'HS384' and 'HS512' * * @throws DomainException Unsupported algorithm was specified * @return string An encrypted message */ private static function sign($msg, $key, $method = 'HS256') { $methods = [ 'HS256' => 'sha256', 'HS384' => 'sha384', 'HS512' => 'sha512', ]; if (empty($methods[$method])) { throw new \DomainException('Algorithm not supported'); } return hash_hmac($methods[$method], $msg, $key, true); } /** * Decode a JSON string into a PHP object. * * @param string $input JSON string * @throws DomainException Provided string was invalid JSON * @return object Object representation of JSON string */ private static function jsonDecode($input) { $obj = json_decode($input); if (function_exists('json_last_error') && $errno = json_last_error()) { self::_handleJsonError($errno); } elseif ($obj === null && $input !== 'null') { throw new \DomainException('Null result with non-null input'); } return $obj; } /** * Encode a PHP object into a JSON string. * * @param object|array $input A PHP object or array * @throws DomainException Provided object could not be encoded to valid JSON * @return string JSON representation of the PHP object or array */ private static function jsonEncode($input) { $json = json_encode($input); if (function_exists('json_last_error') && $errno = json_last_error()) { self::_handleJsonError($errno); } elseif ($json === 'null' && $input !== null) { throw new \DomainException('Null result with non-null input'); } return $json; } /** * Decode a string with URL-safe Base64. * * @param string $input A Base64 encoded string * @return string A decoded string */ private static function urlsafeB64Decode($input) { $remainder = strlen($input) % 4; if ($remainder) { $padlen = 4 - $remainder; $input .= str_repeat('=', $padlen); } return base64_decode(strtr($input, '-_', '+/')); } /** * Encode a string with URL-safe Base64. * * @param string $input The string you want encoded * @return string The base64 encode of what you passed in */ private static function urlsafeB64Encode($input) { return str_replace('=', '', strtr(base64_encode($input), '+/', '-_')); } /** * Helper method to create a JSON error. * * @param int $errno An error number from json_last_error() * @return void */ private static function _handleJsonError($errno) { $messages = [ JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', ]; throw new \DomainException( isset($messages[$errno]) ? $messages[$errno] : 'Unknown JSON error: '.$errno ); } } $secret = 'SERVERSIDE_SECRET'; try { $token = JWT::encode(['user_id' => 1], $secret); echo $token.PHP_EOL; // verify if (JWT::decode($token, $secret, true)) { echo 'Token valid'.PHP_EOL; } else { echo 'Token invalid'; } // tampered try { JWT::decode($token.'X', $secret, true); } catch (\Exception $e) { echo $e->getMessage().PHP_EOL; } // decode print_r(JWT::decode($token, $secret)); } catch (\Exception $e) { echo $e->getMessage(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Found catch point at position: 24
Branch analysis from position: 24
2 jumps found. (Code = 107) Position 1 = 25, Position 2 = -2
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Found catch point at position: 37
Branch analysis from position: 37
2 jumps found. (Code = 107) Position 1 = 38, Position 2 = -2
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7iuYl
function name:  (null)
number of ops:  42
compiled vars:  !0 = $secret, !1 = $token, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  194     0  E >   ASSIGN                                                   !0, 'SERVERSIDE_SECRET'
  197     1        INIT_STATIC_METHOD_CALL                                  'JWT', 'encode'
          2        SEND_VAL                                                 <array>
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
  199     6        CONCAT                                           ~6      !1, '%0A'
          7        ECHO                                                     ~6
  202     8        INIT_STATIC_METHOD_CALL                                  'JWT', 'decode'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 <true>
         12        DO_FCALL                                      0  $7      
         13      > JMPZ                                                     $7, ->16
  203    14    >   ECHO                                                     'Token+valid%0A'
  202    15      > JMP                                                      ->17
  205    16    >   ECHO                                                     'Token+invalid'
  210    17    >   INIT_STATIC_METHOD_CALL                                  'JWT', 'decode'
         18        CONCAT                                           ~8      !1, 'X'
         19        SEND_VAL                                                 ~8
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 <true>
         22        DO_FCALL                                      0          
         23      > JMP                                                      ->29
  211    24  E > > CATCH                                       last         'Exception'
  212    25    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         26        DO_FCALL                                      0  $10     
         27        CONCAT                                           ~11     $10, '%0A'
         28        ECHO                                                     ~11
  216    29    >   INIT_FCALL                                               'print_r'
         30        INIT_STATIC_METHOD_CALL                                  'JWT', 'decode'
         31        SEND_VAR                                                 !1
         32        SEND_VAR                                                 !0
         33        DO_FCALL                                      0  $12     
         34        SEND_VAR                                                 $12
         35        DO_ICALL                                                 
         36      > JMP                                                      ->41
  217    37  E > > CATCH                                       last         'Exception'
  218    38    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         39        DO_FCALL                                      0  $14     
         40        ECHO                                                     $14
  219    41    > > RETURN                                                   1

Class JWT:
Function decode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 49
Branch analysis from position: 45
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 76
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 60
Branch analysis from position: 56
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 76
Branch analysis from position: 72
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
filename:       /in/7iuYl
function name:  decode
number of ops:  78
compiled vars:  !0 = $jwt, !1 = $key, !2 = $verify, !3 = $tks, !4 = $headb64, !5 = $bodyb64, !6 = $cryptob64, !7 = $header, !8 = $payload, !9 = $sig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      <true>
   22     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '.'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !3, $10
   24     8        COUNT                                            ~12     !3
          9        IS_NOT_EQUAL                                             ~12, 3
         10      > JMPZ                                                     ~13, ->15
   25    11    >   NEW                                              $14     'UnexpectedValueException'
         12        SEND_VAL_EX                                              'Wrong+number+of+segments'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $14
   28    15    >   QM_ASSIGN                                        ~16     !3
         16        FETCH_LIST_R                                     $17     ~16, 0
         17        ASSIGN                                                   !4, $17
         18        FETCH_LIST_R                                     $19     ~16, 1
         19        ASSIGN                                                   !5, $19
         20        FETCH_LIST_R                                     $21     ~16, 2
         21        ASSIGN                                                   !6, $21
         22        FREE                                                     ~16
   30    23        INIT_STATIC_METHOD_CALL                                  'jsonDecode'
         24        INIT_STATIC_METHOD_CALL                                  'urlsafeB64Decode'
         25        SEND_VAR_EX                                              !4
         26        DO_FCALL                                      0  $23     
         27        SEND_VAR_NO_REF_EX                                       $23
         28        DO_FCALL                                      0  $24     
         29        ASSIGN                                           ~25     !7, $24
         30        TYPE_CHECK                                    2          ~25
         31      > JMPZ                                                     ~26, ->36
   31    32    >   NEW                                              $27     'UnexpectedValueException'
         33        SEND_VAL_EX                                              'Invalid+segment+encoding'
         34        DO_FCALL                                      0          
         35      > THROW                                         0          $27
   34    36    >   INIT_STATIC_METHOD_CALL                                  'jsonDecode'
         37        INIT_STATIC_METHOD_CALL                                  'urlsafeB64Decode'
         38        SEND_VAR_EX                                              !5
         39        DO_FCALL                                      0  $29     
         40        SEND_VAR_NO_REF_EX                                       $29
         41        DO_FCALL                                      0  $30     
         42        ASSIGN                                           ~31     !8, $30
         43        TYPE_CHECK                                    2          ~31
         44      > JMPZ                                                     ~32, ->49
   35    45    >   NEW                                              $33     'UnexpectedValueException'
         46        SEND_VAL_EX                                              'Invalid+segment+encoding'
         47        DO_FCALL                                      0          
         48      > THROW                                         0          $33
   38    49    >   INIT_STATIC_METHOD_CALL                                  'urlsafeB64Decode'
         50        SEND_VAR_EX                                              !6
         51        DO_FCALL                                      0  $35     
         52        ASSIGN                                                   !9, $35
   40    53      > JMPZ                                                     !2, ->76
   41    54    >   ISSET_ISEMPTY_PROP_OBJ                                   !7, 'alg'
         55      > JMPZ                                                     ~37, ->60
   42    56    >   NEW                                              $38     'DomainException'
         57        SEND_VAL_EX                                              'Empty+algorithm'
         58        DO_FCALL                                      0          
         59      > THROW                                         0          $38
   44    60    >   INIT_STATIC_METHOD_CALL                                  'sign'
         61        ROPE_INIT                                     3  ~41     !4
         62        ROPE_ADD                                      1  ~41     ~41, '.'
         63        ROPE_END                                      2  ~40     ~41, !5
         64        SEND_VAL_EX                                              ~40
         65        SEND_VAR_EX                                              !1
         66        CHECK_FUNC_ARG                                           
         67        FETCH_OBJ_FUNC_ARG                               $43     !7, 'alg'
         68        SEND_FUNC_ARG                                            $43
         69        DO_FCALL                                      0  $44     
         70        IS_NOT_EQUAL                                             !9, $44
         71      > JMPZ                                                     ~45, ->76
   45    72    >   NEW                                              $46     'UnexpectedValueException'
         73        SEND_VAL_EX                                              'Signature+verification+failed'
         74        DO_FCALL                                      0          
         75      > THROW                                         0          $46
   49    76    > > RETURN                                                   !8
   50    77*     > RETURN                                                   null

End of function decode

Function encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7iuYl
function name:  encode
number of ops:  45
compiled vars:  !0 = $payload, !1 = $key, !2 = $algo, !3 = $header, !4 = $segments, !5 = $signing_input, !6 = $signature
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      'HS256'
   67     3        INIT_ARRAY                                       ~7      'JWT', 'typ'
          4        ADD_ARRAY_ELEMENT                                ~7      !2, 'alg'
          5        ASSIGN                                                   !3, ~7
   69     6        ASSIGN                                                   !4, <array>
   70     7        INIT_STATIC_METHOD_CALL                                  'urlsafeB64Encode'
          8        INIT_STATIC_METHOD_CALL                                  'jsonEncode'
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0  $11     
         11        SEND_VAR_NO_REF_EX                                       $11
         12        DO_FCALL                                      0  $12     
         13        ASSIGN_DIM                                               !4
         14        OP_DATA                                                  $12
   71    15        INIT_STATIC_METHOD_CALL                                  'urlsafeB64Encode'
         16        INIT_STATIC_METHOD_CALL                                  'jsonEncode'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $14     
         19        SEND_VAR_NO_REF_EX                                       $14
         20        DO_FCALL                                      0  $15     
         21        ASSIGN_DIM                                               !4
         22        OP_DATA                                                  $15
   72    23        INIT_FCALL                                               'implode'
         24        SEND_VAL                                                 '.'
         25        SEND_VAR                                                 !4
         26        DO_ICALL                                         $16     
         27        ASSIGN                                                   !5, $16
   74    28        INIT_STATIC_METHOD_CALL                                  'sign'
         29        SEND_VAR_EX                                              !5
         30        SEND_VAR_EX                                              !1
         31        SEND_VAR_EX                                              !2
         32        DO_FCALL                                      0  $18     
         33        ASSIGN                                                   !6, $18
   75    34        INIT_STATIC_METHOD_CALL                                  'urlsafeB64Encode'
         35        SEND_VAR_EX                                              !6
         36        DO_FCALL                                      0  $21     
         37        ASSIGN_DIM                                               !4
         38        OP_DATA                                                  $21
   77    39        INIT_FCALL                                               'implode'
         40        SEND_VAL                                                 '.'
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                         $22     
         43      > RETURN                                                   $22
   78    44*     > RETURN                                                   null

End of function encode

Function sign:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7iuYl
function name:  sign
number of ops:  19
compiled vars:  !0 = $msg, !1 = $key, !2 = $method, !3 = $methods
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   91     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      'HS256'
   93     3        ASSIGN                                                   !3, <array>
   98     4        ISSET_ISEMPTY_DIM_OBJ                         1          !3, !2
          5      > JMPZ                                                     ~5, ->10
   99     6    >   NEW                                              $6      'DomainException'
          7        SEND_VAL_EX                                              'Algorithm+not+supported'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $6
  102    10    >   INIT_FCALL                                               'hash_hmac'
         11        FETCH_DIM_R                                      ~8      !3, !2
         12        SEND_VAL                                                 ~8
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $9      
         17      > RETURN                                                   $9
  103    18*     > RETURN                                                   null

End of function sign

Function jsondecode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 22
Branch analysis from position: 13
filename:       /in/7iuYl
function name:  jsonDecode
number of ops:  29
compiled vars:  !0 = $input, !1 = $obj, !2 = $errno
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  112     0  E >   RECV                                             !0      
  114     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
  116     5        INIT_FCALL                                               'function_exists'
          6        SEND_VAL                                                 'json_last_error'
          7        DO_ICALL                                         $5      
          8      > JMPZ_EX                                          ~6      $5, ->13
          9    >   INIT_FCALL                                               'json_last_error'
         10        DO_ICALL                                         $7      
         11        ASSIGN                                           ~8      !2, $7
         12        BOOL                                             ~6      ~8
         13    > > JMPZ                                                     ~6, ->18
  117    14    >   INIT_STATIC_METHOD_CALL                                  '_handleJsonError'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
  116    17      > JMP                                                      ->27
  118    18    >   TYPE_CHECK                                    2  ~10     !1
         19      > JMPZ_EX                                          ~10     ~10, ->22
         20    >   IS_NOT_IDENTICAL                                 ~11     !0, 'null'
         21        BOOL                                             ~10     ~11
         22    > > JMPZ                                                     ~10, ->27
  119    23    >   NEW                                              $12     'DomainException'
         24        SEND_VAL_EX                                              'Null+result+with+non-null+input'
         25        DO_FCALL                                      0          
         26      > THROW                                         0          $12
  122    27    > > RETURN                                                   !1
  123    28*     > RETURN                                                   null

End of function jsondecode

Function jsonencode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 22
Branch analysis from position: 13
filename:       /in/7iuYl
function name:  jsonEncode
number of ops:  29
compiled vars:  !0 = $input, !1 = $json, !2 = $errno
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  132     0  E >   RECV                                             !0      
  134     1        INIT_FCALL                                               'json_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
  135     5        INIT_FCALL                                               'function_exists'
          6        SEND_VAL                                                 'json_last_error'
          7        DO_ICALL                                         $5      
          8      > JMPZ_EX                                          ~6      $5, ->13
          9    >   INIT_FCALL                                               'json_last_error'
         10        DO_ICALL                                         $7      
         11        ASSIGN                                           ~8      !2, $7
         12        BOOL                                             ~6      ~8
         13    > > JMPZ                                                     ~6, ->18
  136    14    >   INIT_STATIC_METHOD_CALL                                  '_handleJsonError'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
  135    17      > JMP                                                      ->27
  137    18    >   IS_IDENTICAL                                     ~10     !1, 'null'
         19      > JMPZ_EX                                          ~10     ~10, ->22
         20    >   TYPE_CHECK                                  1020  ~11     !0
         21        BOOL                                             ~10     ~11
         22    > > JMPZ                                                     ~10, ->27
  138    23    >   NEW                                              $12     'DomainException'
         24        SEND_VAL_EX                                              'Null+result+with+non-null+input'
         25        DO_FCALL                                      0          
         26      > THROW                                         0          $12
  141    27    > > RETURN                                                   !1
  142    28*     > RETURN                                                   null

End of function jsonencode

Function urlsafeb64decode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/7iuYl
function name:  urlsafeB64Decode
number of ops:  22
compiled vars:  !0 = $input, !1 = $remainder, !2 = $padlen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  150     0  E >   RECV                                             !0      
  152     1        STRLEN                                           ~3      !0
          2        MOD                                              ~4      ~3, 4
          3        ASSIGN                                                   !1, ~4
  153     4      > JMPZ                                                     !1, ->12
  154     5    >   SUB                                              ~6      4, !1
          6        ASSIGN                                                   !2, ~6
  155     7        INIT_FCALL                                               'str_repeat'
          8        SEND_VAL                                                 '%3D'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $8      
         11        ASSIGN_OP                                     8          !0, $8
  158    12    >   INIT_FCALL                                               'base64_decode'
         13        INIT_FCALL                                               'strtr'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 '-_'
         16        SEND_VAL                                                 '%2B%2F'
         17        DO_ICALL                                         $10     
         18        SEND_VAR                                                 $10
         19        DO_ICALL                                         $11     
         20      > RETURN                                                   $11
  159    21*     > RETURN                                                   null

End of function urlsafeb64decode

Function urlsafeb64encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7iuYl
function name:  urlsafeB64Encode
number of ops:  16
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  167     0  E >   RECV                                             !0      
  169     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%3D'
          3        SEND_VAL                                                 ''
          4        INIT_FCALL                                               'strtr'
          5        INIT_FCALL                                               'base64_encode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $1      
          8        SEND_VAR                                                 $1
          9        SEND_VAL                                                 '%2B%2F'
         10        SEND_VAL                                                 '-_'
         11        DO_ICALL                                         $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                         $3      
         14      > RETURN                                                   $3
  170    15*     > RETURN                                                   null

End of function urlsafeb64encode

Function _handlejsonerror:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/7iuYl
function name:  _handleJsonError
number of ops:  14
compiled vars:  !0 = $errno, !1 = $messages
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  178     0  E >   RECV                                             !0      
  180     1        ASSIGN                                                   !1, <array>
  186     2        NEW                                              $3      'DomainException'
  187     3        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !0
          4      > JMPZ                                                     ~4, ->8
  188     5    >   FETCH_DIM_R                                      ~5      !1, !0
          6        QM_ASSIGN                                        ~6      ~5
          7      > JMP                                                      ->10
  189     8    >   CONCAT                                           ~7      'Unknown+JSON+error%3A+', !0
          9        QM_ASSIGN                                        ~6      ~7
         10    >   SEND_VAL_EX                                              ~6
  186    11        DO_FCALL                                      0          
  189    12      > THROW                                         0          $3
  191    13*     > RETURN                                                   null

End of function _handlejsonerror

End of class JWT.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.69 ms | 1048 KiB | 26 Q