php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43158 [ssl_verify_result] => 0
Submitted: 2007-10-31 10:51 UTC Modified: 2008-07-29 21:53 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: p dot vanbrouwershaven at networking4all dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2CVS-2008-07-21 OS: Linux *** 2.6.8-2-686 #1 Tue Au
Private report: No CVE-ID: None
 [2007-10-31 10:51 UTC] p dot vanbrouwershaven at networking4all dot com
Description:
------------
I have some problems with the curl. On the console I get the right
response message but in PHP I see no difference between a valid and an
invalid SSL Certificate.

Curl command in PHP:

        $url = ' https://verisign.com';

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLE_OPERATION_TIMEOUTED, 10);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
        $result = curl_exec ($ch);
        $info = curl_getinfo($ch);
        curl_close ($ch);

        print_r($info);

Curl command on console:

        curl -I https://verisign.com

Console result:

curl -I https://verisign.com
curl: (51) SSL: certificate subject name 'www.verisign.com' does not
match target host name 'verisign.com' 

PHP Result:
[ssl_verify_result] => 0



Reproduce code:
---------------
$url = ' https://verisign.com';
	
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLE_OPERATION_TIMEOUTED, 10);
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

$result = curl_exec ($ch);
$info = curl_getinfo($ch);
curl_close ($ch);

print_r($info);

Expected result:
----------------
Array
(
    [url] =>  https://verisign.com
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 51
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 0
    [connect_time] => 0
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 0
    [redirect_time] => 0
)

Actual result:
--------------
Array
(
    [url] =>  https://verisign.com
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 0
    [connect_time] => 0
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 0
    [redirect_time] => 0
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-31 11:35 UTC] p dot vanbrouwershaven at networking4all dot com
There was a space in my post just before http:// this is not the problem but just an error in my post.

$url = ' https://verisign.com';

Array
(
    [url] => https://verisign.com
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 3.5E-05
    [connect_time] => 0.155727
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 0
    [redirect_time] => 0
)
 [2008-07-21 12:34 UTC] p dot vanbrouwershaven at networking4all dot com
I tried with php5.2-200807211030 but the problem still exists.

curl_error returns:

SSL: certificate subject name 'www.verisign.com' does not match target host name 'verisign.com'

curl_getinfo returns:

Array
(
    [url] => https://verisign.com/
    [content_type] => text/html
    [http_code] => 301
    [header_size] => 182
    [request_size] => 135
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 1.072121
    [namelookup_time] => 0.184282
    [connect_time] => 0.342402
    [pretransfer_time] => 0.905169
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 1.07203
    [redirect_time] => 0
    [certinfo] => 
)
 [2008-07-29 21:53 UTC] felipe@php.net
That is a bug in libcurl.


Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 04:01:30 2024 UTC