php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65684 No error message on wrong SSL certificate with curl_multi
Submitted: 2013-09-16 18:48 UTC Modified: 2013-11-12 04:16 UTC
From: butesa at freenet dot de Assigned: pierrick (profile)
Status: Not a bug Package: cURL related
PHP Version: 5.5.3 OS: Ubuntu 12.04 x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: butesa at freenet dot de
New email:
PHP Version: OS:

 

 [2013-09-16 18:48 UTC] butesa at freenet dot de
Description:
------------
If you add a curl handle to a curl_multi handle and execute it, you can afterwards use curl_error() on the curl handle. But this doesn't work when the SSL certificate doesn't match the servers name.

Test script:
---------------
<?php
$c = curl_init('https://j-matschke.de');
curl_exec($c);
var_dump(curl_errno($c));
var_dump(curl_error($c));
echo "\n";

$m = curl_multi_init();
curl_multi_add_handle($m,$c);
$running = 1;
while ($running == 1)
{
	while (curl_multi_exec($m, $running) == CURLM_CALL_MULTI_PERFORM);
	while ($done = curl_multi_info_read($m))
	{
		var_dump($done['result']);
		var_dump(curl_error($done['handle']));
	}
	sleep(1);
}

Expected result:
----------------
int(51)
string(49) "SSL peer certificate or SSH remote key was not OK"

int(51)
string(49) "SSL peer certificate or SSH remote key was not OK"

Actual result:
--------------
int(51)
string(49) "SSL peer certificate or SSH remote key was not OK"

int(51)
string(0) ""

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-17 10:55 UTC] roborg at hotmail dot com
Same thing is happening to me on PHP 5.4.9 but just using curl_exec, not 
curl_multi.

<?php

$c = curl_init();

$opts = array
(
	CURLOPT_URL => 'https://xxxxx'
	CURLOPT_RETURNTRANSFER => true,
);

curl_setopt_array($c, $opts);

var_dump(curl_exec($c));
var_dump(curl_errno($c));
var_dump(curl_error($c));

curl_close($c);

Expected result:
----------------
bool(false)
int(51)
string(49) "SSL peer certificate or SSH remote key was not OK"

Actual result:
----------------
bool(false)
int(51)
string(0) ""
 [2013-11-08 00:14 UTC] pierrick@php.net
-Status: Open +Status: Feedback
 [2013-11-08 00:14 UTC] pierrick@php.net
Worked for me with 5.5.3 and cURL 7.33.1-dev

Can you tell me which version of libcurl you're having problem with ?

Thanks
 [2013-11-08 08:34 UTC] butesa at freenet dot de
-Status: Feedback +Status: Open
 [2013-11-08 08:34 UTC] butesa at freenet dot de
I'm using curl 7.22.0
 [2013-11-12 04:16 UTC] pierrick@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: pierrick
 [2013-11-12 04:16 UTC] pierrick@php.net
I tested this with multiple libcurl version and the result is the one expected in newer libcurl version like 7.33.0 which is the last one.

You should try to update your libcurl version and then retest.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 21:01:36 2024 UTC