From: p dot vanbrouwershaven at networking4all dot com
Operating system: Linux *** 2.6.8-2-686 #1 Tue Au
PHP version: 5.2.4
PHP Bug Type: OpenSSL related
Bug description: [ssl_verify_result] => 0
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
)
--
Edit bug report at http://bugs.php.net/?id=43158&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43158&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43158&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43158&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43158&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43158&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43158&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43158&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43158&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43158&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43158&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43158&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43158&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43158&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43158&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43158&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43158&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43158&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43158&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43158&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43158&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43158&r=mysqlcfg