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 = true; $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 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 65
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 60
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 91, Position 2 = 98
Branch analysis from position: 91
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 98
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 76
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 91, Position 2 = 98
Branch analysis from position: 91
Branch analysis from position: 98
Branch analysis from position: 76
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 65
Branch analysis from position: 52
Branch analysis from position: 65
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
Branch analysis from position: 35
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
Branch analysis from position: 23
filename:       /in/I2cie
function name:  (null)
number of ops:  106
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        ASSIGN                                                   !1, <true>
   23    15        FETCH_IS                                         ~18     '_GET'
         16        ISSET_ISEMPTY_DIM_OBJ                         0          ~18, 'qualys'
         17      > JMPZ                                                     ~19, ->23
         18    >   FETCH_R                      global              ~20     '_GET'
         19        FETCH_DIM_R                                      ~21     ~20, 'qualys'
         20        BOOL                                             ~22     ~21
         21        QM_ASSIGN                                        ~23     ~22
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~23     <false>
         24    >   ASSIGN                                                   !2, ~23
   27    25        INIT_FCALL                                               'implode'
         26        SEND_VAL                                                 '%3A'
   28    27        SEND_VAL                                                 <array>
         28        DO_ICALL                                         $25     
   27    29        ASSIGN                                                   !3, $25
   65    30        BOOL_NOT                                         ~27     !2
         31      > JMPZ                                                     ~27, ->35
   66    32    >   ASSIGN                                                   !4, 'https%3A%2F%2Fwww.howsmyssl.com'
   67    33        ASSIGN                                                   !5, 'howsmyssl.com'
         34      > JMP                                                      ->37
   69    35    >   ASSIGN                                                   !4, 'https%3A%2F%2Fwww.ssllabs.com%2Fssltest%2FviewMyClient.html'
   70    36        ASSIGN                                                   !5, 'www.ssllabs.com'
   72    37    >   INIT_FCALL                                               'stream_context_create'
   74    38        INIT_ARRAY                                       ~32     !3, 'ciphers'
         39        ADD_ARRAY_ELEMENT                                ~32     <true>, 'verify_peer'
   76    40        ADD_ARRAY_ELEMENT                                ~32     '%2Fetc%2Fssl%2Fcerts%2Fca-certificates.crt', 'cafile'
   77    41        ADD_ARRAY_ELEMENT                                ~32     !5, 'CN_match'
   78    42        ADD_ARRAY_ELEMENT                                ~32     3, 'verify_depth'
   74    43        ADD_ARRAY_ELEMENT                                ~32     <true>, 'disable_compression'
         44        ADD_ARRAY_ELEMENT                                ~32     <true>, 'SNI_enabled'
   81    45        ADD_ARRAY_ELEMENT                                ~32     !5, 'SNI_server_name'
         46        INIT_ARRAY                                       ~33     ~32, 'ssl'
         47        SEND_VAL                                                 ~33
         48        DO_ICALL                                         $34     
   72    49        ASSIGN                                                   !6, $34
   84    50        BOOL_NOT                                         ~36     !1
         51      > JMPZ                                                     ~36, ->65
   85    52    > > JMPZ                                                     !0, ->60
   86    53    >   INIT_FCALL                                               'file_get_contents'
         54        SEND_VAR                                                 !4
         55        SEND_VAL                                                 null
         56        SEND_VAR                                                 !6
         57        DO_ICALL                                         $37     
         58        ASSIGN                                                   !7, $37
         59      > JMP                                                      ->64
   88    60    >   INIT_FCALL                                               'file_get_contents'
         61        SEND_VAR                                                 !4
         62        DO_ICALL                                         $39     
         63        ASSIGN                                                   !7, $39
         64    > > JMP                                                      ->89
   91    65    >   INIT_FCALL_BY_NAME                                       'curl_init'
         66        SEND_VAR_EX                                              !4
         67        DO_FCALL                                      0  $41     
         68        ASSIGN                                                   !8, $41
   92    69      > JMPZ                                                     !0, ->76
   93    70    >   INIT_FCALL_BY_NAME                                       'curl_setopt'
         71        SEND_VAR_EX                                              !8
         72        FETCH_CONSTANT                                   ~43     'CURLOPT_SSL_CIPHER_LIST'
         73        SEND_VAL_EX                                              ~43
         74        SEND_VAR_EX                                              !3
         75        DO_FCALL                                      0          
   95    76    >   INIT_FCALL_BY_NAME                                       'curl_setopt'
         77        SEND_VAR_EX                                              !8
         78        FETCH_CONSTANT                                   ~45     'CURLOPT_RETURNTRANSFER'
         79        SEND_VAL_EX                                              ~45
         80        SEND_VAL_EX                                              1
         81        DO_FCALL                                      0          
   96    82        INIT_FCALL_BY_NAME                                       'curl_exec'
         83        SEND_VAR_EX                                              !8
         84        DO_FCALL                                      0  $47     
         85        ASSIGN                                                   !7, $47
   97    86        INIT_FCALL_BY_NAME                                       'curl_close'
         87        SEND_VAR_EX                                              !8
         88        DO_FCALL                                      0          
   99    89    >   BOOL_NOT                                         ~50     !2
         90      > JMPZ                                                     ~50, ->98
  100    91    >   INIT_FCALL                                               'str_replace'
         92        SEND_VAL                                                 'href%3D%22%2F'
         93        SEND_VAL                                                 'href%3D%22https%3A%2F%2Fwww.howsmyssl.com%2F'
         94        SEND_VAR                                                 !7
         95        DO_ICALL                                         $51     
         96        ASSIGN                                                   !7, $51
         97      > JMP                                                      ->104
  102    98    >   INIT_FCALL                                               'str_replace'
         99        SEND_VAL                                                 'href%3D%22%2F'
        100        SEND_VAL                                                 'href%3D%22https%3A%2F%2Fwww.ssllabs.com%2F'
        101        SEND_VAR                                                 !7
        102        DO_ICALL                                         $53     
        103        ASSIGN                                                   !7, $53
  104   104    >   ECHO                                                     !7
        105      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.92 ms | 1404 KiB | 23 Q