File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -1199,6 +1199,11 @@ static void _php_curl_set_default_options(php_curl *ch)
11991199	if  (cainfo  &&  cainfo [0 ] !=  '\0' ) {
12001200		curl_easy_setopt (ch -> cp , CURLOPT_CAINFO , cainfo );
12011201	}
1202+ #if  LIBCURL_VERSION_NUM  >= 0x075400 
1203+ 	else  {
1204+ 		curl_easy_setopt (ch -> cp , CURLOPT_SSL_OPTIONS , CURLSSLOPT_NATIVE_CA );
1205+ 	}
1206+ #endif 
12021207
12031208#ifdef  ZTS 
12041209	curl_easy_setopt (ch -> cp , CURLOPT_NOSIGNAL , 1 );
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Curl defaulting to default CA root store, especially in Windows
3+ --EXTENSIONS--
4+ curl
5+ --DESCRIPTION--
6+ On Windows, there is no fallback root CA store, so all HTTPS requests that require validation (default)
7+ fail by default. Curl >= 7.71.0 has a CURLOPT_SSL_OPTIONS = CURLSSLOPT_NATIVE_CA option that falls back
8+ to Windows root CA store.
9+ --SKIPIF--
10+ <?php 
11+ if  (getenv ("SKIP_ONLINE_TESTS " )) die ("skip online test " );
12+ $ curl_version  = curl_version ();
13+ if  ($ curl_version ['version_number ' ] < 0x074700 ) {
14+     die ("skip: test works only with curl >= 7.71.0 " );
15+ }
16+ ?> 
17+ --INI--
18+ 
19+ --FILE--
20+ <?php 
21+     $ ch  = curl_init ('https://sha256.badssl.com/ ' );
22+     $ cert  = curl_getinfo ($ ch , CURLINFO_CAINFO );
23+     var_dump ($ cert );
24+     curl_setopt_array ($ ch , [
25+         CURLOPT_RETURNTRANSFER  => true ,
26+         CURLOPT_SSL_VERIFYHOST  => 2 ,
27+         CURLOPT_SSL_VERIFYPEER  => 1 ,
28+     ]);
29+ 
30+     curl_exec ($ ch );
31+     var_dump (curl_getinfo ($ ch , CURLINFO_SSL_VERIFYRESULT ));
32+ 
33+ ?> 
34+ --EXPECT--
35+ int(0)
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments