3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_errors', 1); /** * This script check how PHP makes HTTPS (SSL/TLS) requests using PHP Streams * or cURL. Configuration options are passed as GET parameters, for example: * http://localhost/checksslcontext.php?reconfigure=1 * * Configuration: * http://localhost/checksslcontext.php * Basic PHP Streams using file_get_contents(). Default settings. * http://localhost/checksslcontext.php?reconfigure=1 * As above but reconfigures SSL Context for PHP Streams to be secure. * It will also reconfigure cURL (if selected) to use the Mozilla ciphersuite. * http://localhost/checksslcontext.php?curl=1 * Use cURL instead of PHP Streams (good to compare!) * http://localhost/checksslcontext.php?qualys=1 * Use the Qualys SSL Labs service instead of http://www.howsmyssl.com * * This script reflects result output from howsmyssl.com and ssllabs.com to your browser. */ $reconfigure = isset($_GET['reconfigure']) ? (bool) $_GET['reconfigure'] : false; $usecurl = isset($_GET['curl']) ? (bool) $_GET['curl'] : false; $checkqualys = isset($_GET['qualys']) ? (bool) $_GET['qualys'] : false; /** * https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_Ciphersuite */ $ciphers = implode(':', array( 'ECDHE-RSA-AES128-GCM-SHA256', 'ECDHE-ECDSA-AES128-GCM-SHA256', 'ECDHE-RSA-AES256-GCM-SHA384', 'ECDHE-ECDSA-AES256-GCM-SHA384', 'DHE-RSA-AES128-GCM-SHA256', 'DHE-DSS-AES128-GCM-SHA256', 'kEDH+AESGCM', 'ECDHE-RSA-AES128-SHA256', 'ECDHE-ECDSA-AES128-SHA256', 'ECDHE-RSA-AES128-SHA', 'ECDHE-ECDSA-AES128-SHA', 'ECDHE-RSA-AES256-SHA384', 'ECDHE-ECDSA-AES256-SHA384', 'ECDHE-RSA-AES256-SHA', 'ECDHE-ECDSA-AES256-SHA', 'DHE-RSA-AES128-SHA256', 'DHE-RSA-AES128-SHA', 'DHE-DSS-AES128-SHA256', 'DHE-RSA-AES256-SHA256', 'DHE-DSS-AES256-SHA', 'DHE-RSA-AES256-SHA', 'AES128-GCM-SHA256', 'AES256-GCM-SHA384', 'ECDHE-RSA-RC4-SHA', 'ECDHE-ECDSA-RC4-SHA', 'AES128', 'AES256', 'RC4-SHA', 'HIGH', '!aNULL', '!eNULL', '!EXPORT', '!DES', '!3DES', '!MD5', '!PSK' )); if (!$checkqualys) { $url = 'https://www.howsmyssl.com'; $domain = 'howsmyssl.com'; } else { $url = 'https://www.ssllabs.com/ssltest/viewMyClient.html'; $domain = 'www.ssllabs.com'; } $context = stream_context_create(array( 'ssl' => array( 'ciphers' => $ciphers, 'verify_peer' => true, 'cafile' => '/etc/ssl/certs/ca-certificates.crt', // <-- EDIT FOR NON-DEBIAN/UBUNTU SYSTEMS 'CN_match' => $domain, 'verify_depth' => 3, 'disable_compression' => true, 'SNI_enabled' => true, 'SNI_server_name' => $domain ) )); if (!$usecurl) { if ($reconfigure) { $html = file_get_contents($url, null, $context); } else { $html = file_get_contents($url); // This default will be BAD! } } else { $ch = curl_init($url); if ($reconfigure) { curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $html = curl_exec($ch); curl_close($ch); } if (!$checkqualys) { $html = str_replace('href="/', 'href="https://www.howsmyssl.com/', $html); } else { $html = str_replace('href="/', 'href="https://www.ssllabs.com/', $html); } echo $html;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 44
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 74
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 69
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 107
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 113
Branch analysis from position: 113
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 107
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 85
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 107
Branch analysis from position: 100
Branch analysis from position: 107
Branch analysis from position: 85
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 74
Branch analysis from position: 61
Branch analysis from position: 74
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 44
Branch analysis from position: 41
Branch analysis from position: 44
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
Branch analysis from position: 32
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
Branch analysis from position: 22
filename:       /in/pjfVq
function name:  (null)
number of ops:  115
compiled vars:  !0 = $reconfigure, !1 = $usecurl, !2 = $checkqualys, !3 = $ciphers, !4 = $url, !5 = $domain, !6 = $context, !7 = $html, !8 = $ch
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'display_errors'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                                 
   21     4        FETCH_IS                                         ~10     '_GET'
          5        ISSET_ISEMPTY_DIM_OBJ                         0          ~10, 'reconfigure'
          6      > JMPZ                                                     ~11, ->12
          7    >   FETCH_R                      global              ~12     '_GET'
          8        FETCH_DIM_R                                      ~13     ~12, 'reconfigure'
          9        BOOL                                             ~14     ~13
         10        QM_ASSIGN                                        ~15     ~14
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~15     <false>
         13    >   ASSIGN                                                   !0, ~15
   22    14        FETCH_IS                                         ~17     '_GET'
         15        ISSET_ISEMPTY_DIM_OBJ                         0          ~17, 'curl'
         16      > JMPZ                                                     ~18, ->22
         17    >   FETCH_R                      global              ~19     '_GET'
         18        FETCH_DIM_R                                      ~20     ~19, 'curl'
         19        BOOL                                             ~21     ~20
         20        QM_ASSIGN                                        ~22     ~21
         21      > JMP                                                      ->23
         22    >   QM_ASSIGN                                        ~22     <false>
         23    >   ASSIGN                                                   !1, ~22
   23    24        FETCH_IS                                         ~24     '_GET'
         25        ISSET_ISEMPTY_DIM_OBJ                         0          ~24, 'qualys'
         26      > JMPZ                                                     ~25, ->32
         27    >   FETCH_R                      global              ~26     '_GET'
         28        FETCH_DIM_R                                      ~27     ~26, 'qualys'
         29        BOOL                                             ~28     ~27
         30        QM_ASSIGN                                        ~29     ~28
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~29     <false>
         33    >   ASSIGN                                                   !2, ~29
   27    34        INIT_FCALL                                               'implode'
         35        SEND_VAL                                                 '%3A'
   28    36        SEND_VAL                                                 <array>
         37        DO_ICALL                                         $31     
   27    38        ASSIGN                                                   !3, $31
   65    39        BOOL_NOT                                         ~33     !2
         40      > JMPZ                                                     ~33, ->44
   66    41    >   ASSIGN                                                   !4, 'https%3A%2F%2Fwww.howsmyssl.com'
   67    42        ASSIGN                                                   !5, 'howsmyssl.com'
         43      > JMP                                                      ->46
   69    44    >   ASSIGN                                                   !4, 'https%3A%2F%2Fwww.ssllabs.com%2Fssltest%2FviewMyClient.html'
   70    45        ASSIGN                                                   !5, 'www.ssllabs.com'
   72    46    >   INIT_FCALL                                               'stream_context_create'
   74    47        INIT_ARRAY                                       ~38     !3, 'ciphers'
         48        ADD_ARRAY_ELEMENT                                ~38     <true>, 'verify_peer'
   76    49        ADD_ARRAY_ELEMENT                                ~38     '%2Fetc%2Fssl%2Fcerts%2Fca-certificates.crt', 'cafile'
   77    50        ADD_ARRAY_ELEMENT                                ~38     !5, 'CN_match'
   78    51        ADD_ARRAY_ELEMENT                                ~38     3, 'verify_depth'
   74    52        ADD_ARRAY_ELEMENT                                ~38     <true>, 'disable_compression'
         53        ADD_ARRAY_ELEMENT                                ~38     <true>, 'SNI_enabled'
   81    54        ADD_ARRAY_ELEMENT                                ~38     !5, 'SNI_server_name'
         55        INIT_ARRAY                                       ~39     ~38, 'ssl'
         56        SEND_VAL                                                 ~39
         57        DO_ICALL                                         $40     
   72    58        ASSIGN                                                   !6, $40
   84    59        BOOL_NOT                                         ~42     !1
         60      > JMPZ                                                     ~42, ->74
   85    61    > > JMPZ                                                     !0, ->69
   86    62    >   INIT_FCALL                                               'file_get_contents'
         63        SEND_VAR                                                 !4
         64        SEND_VAL                                                 null
         65        SEND_VAR                                                 !6
         66        DO_ICALL                                         $43     
         67        ASSIGN                                                   !7, $43
         68      > JMP                                                      ->73
   88    69    >   INIT_FCALL                                               'file_get_contents'
         70        SEND_VAR                                                 !4
         71        DO_ICALL                                         $45     
         72        ASSIGN                                                   !7, $45
         73    > > JMP                                                      ->98
   91    74    >   INIT_FCALL_BY_NAME                                       'curl_init'
         75        SEND_VAR_EX                                              !4
         76        DO_FCALL                                      0  $47     
         77        ASSIGN                                                   !8, $47
   92    78      > JMPZ                                                     !0, ->85
   93    79    >   INIT_FCALL_BY_NAME                                       'curl_setopt'
         80        SEND_VAR_EX                                              !8
         81        FETCH_CONSTANT                                   ~49     'CURLOPT_SSL_CIPHER_LIST'
         82        SEND_VAL_EX                                              ~49
         83        SEND_VAR_EX                                              !3
         84        DO_FCALL                                      0          
   95    85    >   INIT_FCALL_BY_NAME                                       'curl_setopt'
         86        SEND_VAR_EX                                              !8
         87        FETCH_CONSTANT                                   ~51     'CURLOPT_RETURNTRANSFER'
         88        SEND_VAL_EX                                              ~51
         89        SEND_VAL_EX                                              1
         90        DO_FCALL                                      0          
   96    91        INIT_FCALL_BY_NAME                                       'curl_exec'
         92        SEND_VAR_EX                                              !8
         93        DO_FCALL                                      0  $53     
         94        ASSIGN                                                   !7, $53
   97    95        INIT_FCALL_BY_NAME                                       'curl_close'
         96        SEND_VAR_EX                                              !8
         97        DO_FCALL                                      0          
   99    98    >   BOOL_NOT                                         ~56     !2
         99      > JMPZ                                                     ~56, ->107
  100   100    >   INIT_FCALL                                               'str_replace'
        101        SEND_VAL                                                 'href%3D%22%2F'
        102        SEND_VAL                                                 'href%3D%22https%3A%2F%2Fwww.howsmyssl.com%2F'
        103        SEND_VAR                                                 !7
        104        DO_ICALL                                         $57     
        105        ASSIGN                                                   !7, $57
        106      > JMP                                                      ->113
  102   107    >   INIT_FCALL                                               'str_replace'
        108        SEND_VAL                                                 'href%3D%22%2F'
        109        SEND_VAL                                                 'href%3D%22https%3A%2F%2Fwww.ssllabs.com%2F'
        110        SEND_VAR                                                 !7
        111        DO_ICALL                                         $59     
        112        ASSIGN                                                   !7, $59
  104   113    >   ECHO                                                     !7
        114      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
286.86 ms | 1408 KiB | 24 Q