3v4l.org

run code in 300+ PHP versions simultaneously
<?php function login() { if(isset($_POST["user"]) && isset($_POST["password"])) { $postUserID = DataFormat::parsePersonID($_POST["user"]); if(!$postUserID) { return false; } $user = $this->db->getPerson($postUserID); if(!$user) { return false; } if ($user["activated"] == 0){ return false; } $hashedPassword = hash("sha512", $_POST["password"] . $user["salt"]); if($hashedPassword != $user["password"]) { return false; } if(!in_array($user["id"], $this->testUsers)) { return false; } $_SESSION["user"] = $user; $_SESSION["loginKey"] = $this->getLoginKey(); return true; } return false; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gatrd
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   1

Function login:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 63
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 53
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/gatrd
function name:  login
number of ops:  65
compiled vars:  !0 = $postUserID, !1 = $user, !2 = $hashedPassword
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_IS                                         ~3      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      ~3, 'user'
          2      > JMPZ_EX                                          ~4      ~4, ->6
          3    >   FETCH_IS                                         ~5      '_POST'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      ~5, 'password'
          5        BOOL                                             ~4      ~6
          6    > > JMPZ                                                     ~4, ->63
    4     7    >   INIT_STATIC_METHOD_CALL                                  'DataFormat', 'parsePersonID'
          8        CHECK_FUNC_ARG                                           
          9        FETCH_FUNC_ARG               global              $7      '_POST'
         10        FETCH_DIM_FUNC_ARG                               $8      $7, 'user'
         11        SEND_FUNC_ARG                                            $8
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !0, $9
    5    14        BOOL_NOT                                         ~11     !0
         15      > JMPZ                                                     ~11, ->17
    6    16    > > RETURN                                                   <false>
    8    17    >   FETCH_THIS                                       $12     
         18        FETCH_OBJ_R                                      ~13     $12, 'db'
         19        INIT_METHOD_CALL                                         ~13, 'getPerson'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $14     
         22        ASSIGN                                                   !1, $14
    9    23        BOOL_NOT                                         ~16     !1
         24      > JMPZ                                                     ~16, ->26
   10    25    > > RETURN                                                   <false>
   12    26    >   FETCH_DIM_R                                      ~17     !1, 'activated'
         27        IS_EQUAL                                                 ~17, 0
         28      > JMPZ                                                     ~18, ->30
   13    29    > > RETURN                                                   <false>
   15    30    >   INIT_FCALL                                               'hash'
         31        SEND_VAL                                                 'sha512'
         32        FETCH_R                      global              ~19     '_POST'
         33        FETCH_DIM_R                                      ~20     ~19, 'password'
         34        FETCH_DIM_R                                      ~21     !1, 'salt'
         35        CONCAT                                           ~22     ~20, ~21
         36        SEND_VAL                                                 ~22
         37        DO_ICALL                                         $23     
         38        ASSIGN                                                   !2, $23
   16    39        FETCH_DIM_R                                      ~25     !1, 'password'
         40        IS_NOT_EQUAL                                             !2, ~25
         41      > JMPZ                                                     ~26, ->43
   17    42    > > RETURN                                                   <false>
   19    43    >   INIT_FCALL                                               'in_array'
         44        FETCH_DIM_R                                      ~27     !1, 'id'
         45        SEND_VAL                                                 ~27
         46        FETCH_THIS                                       $28     
         47        FETCH_OBJ_R                                      ~29     $28, 'testUsers'
         48        SEND_VAL                                                 ~29
         49        DO_ICALL                                         $30     
         50        BOOL_NOT                                         ~31     $30
         51      > JMPZ                                                     ~31, ->53
   20    52    > > RETURN                                                   <false>
   22    53    >   FETCH_W                      global              $32     '_SESSION'
         54        ASSIGN_DIM                                               $32, 'user'
         55        OP_DATA                                                  !1
   23    56        FETCH_THIS                                       $36     
         57        INIT_METHOD_CALL                                         $36, 'getLoginKey'
         58        DO_FCALL                                      0  $37     
         59        FETCH_W                      global              $34     '_SESSION'
         60        ASSIGN_DIM                                               $34, 'loginKey'
         61        OP_DATA                                                  $37
   24    62      > RETURN                                                   <true>
   26    63    > > RETURN                                                   <false>
   27    64*     > RETURN                                                   null

End of function login

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.08 ms | 1400 KiB | 17 Q