php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70537 CURLPROTO_HTTPS not handled in PHP >=5.4.33, 5.5.17, 5.6.1
Submitted: 2015-09-20 18:07 UTC Modified: 2016-04-24 01:02 UTC
Votes:3
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: megamurmulis at gmail dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.4.33, 5.5.17, 5.6.1 OS: Any
Private report: No CVE-ID: None
 [2015-09-20 18:07 UTC] megamurmulis at gmail dot com
Description:
------------
#PROBLEM:
In PHP >=5.4.33 (including 5.4.45), when using "CURLOPT_PROTOCOLS" with "CURLPROTO_HTTPS" (any combination other than CURLPROTO_ALL) - request on "https://" urls fail with error: "Protocol "https" not supported or disabled in libcurl".


#PHP ( http://windows.php.net/downloads/releases/archives/ )
php-5.4.32-Win32-VC9-x86.zip (and older = working ok)
php-5.4.33-Win32-VC9-x86.zip (and newer = fails)

#SETUP:
Extract PHP zip; use php.ini-development (set "extension_dir"; enable extensions: php_curl.dll, php_openssl.dll)

#TEST:
Run cmd from php folder:  php.exe -f test_SSL2.php


#NOTE:
If "/ext/php_curl.dll" is overwritten with an older version (i.e. v5.4.32) = CURLPROTO_HTTPS is correctly handled and request suceeds in newer PHP versions too - so issue seems to be in library "php_curl.dll"..

Test script:
---------------
<?php
@error_reporting(E_ALL);
@ini_set('display_errors', true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,              'https://www.google.com/');
curl_setopt($ch, CURLOPT_TIMEOUT,          15);
curl_setopt($ch, CURLOPT_HEADER,           false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,   true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT,    true);
curl_setopt($ch, CURLOPT_FORBID_REUSE,     true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,   true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,   false);
curl_setopt($ch, CURLOPT_PROTOCOLS,        CURLPROTO_HTTP or CURLPROTO_HTTPS);
$data = curl_exec($ch);
if ($data === false)
	die('cURL error: '. curl_error($ch));
curl_close($ch);
echo 'DATA: '. strlen($data) .'B';


Expected result:
----------------
Request is supposed to succeed due https protocol being allowed (via CURLPROTO_HTTPS)..

Actual result:
--------------
Request fails, curl_error() shows error:
"Protocol "https" not supported or disabled in libcurl"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-21 15:41 UTC] megamurmulis at gmail dot com
Also confirmed to have same issue:

php-5.5.16-Win32-VC11-x86.zip   = working (and older)
php-5.5.17-Win32-VC11-x86.zip   = failed  (and newer, including 5.5.29)

php-5.6.0-Win32-VC11-x86.zip    = working (and older)
php-5.6.1-Win32-VC11-x86.zip    = failed  (and newer, including 5.6.13)

So seems all later branches also affected..
 [2015-09-21 15:51 UTC] megamurmulis at gmail dot com
-Summary: CURLPROTO_HTTPS not handled in PHP >=5.4.33 +Summary: CURLPROTO_HTTPS not handled in PHP >=5.4.33, 5.5.17, 5.6.1 -Operating System: Windows XP +Operating System: Any -PHP Version: 5.4.45 +PHP Version: 5.4.33, 5.5.17, 5.6.1
 [2015-09-21 15:51 UTC] megamurmulis at gmail dot com
#Checked and updated other versions:

php-5.3.29-Win32-VC9-x86        = all working

php-5.4.32-Win32-VC9-x86.zip    = working (and older)
php-5.4.33-Win32-VC9-x86.zip    = failed  (and newer, including 5.4.45)

php-5.5.16-Win32-VC11-x86.zip   = working (and older)
php-5.5.17-Win32-VC11-x86.zip   = failed  (and newer, including 5.5.29)

php-5.6.0-Win32-VC11-x86.zip    = working (and older)
php-5.6.1-Win32-VC11-x86.zip    = failed  (and newer, including 5.6.13)
 [2016-04-24 01:02 UTC] pierrick@php.net
-Status: Open +Status: Not a bug
 [2016-04-24 01:02 UTC] pierrick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

In your sample you're using 

curl_setopt($ch, CURLOPT_PROTOCOLS,        CURLPROTO_HTTP or CURLPROTO_HTTPS);

instead of

curl_setopt($ch, CURLOPT_PROTOCOLS,        CURLPROTO_HTTP | CURLPROTO_HTTPS);
 [2016-04-24 01:28 UTC] megamurmulis at gmail dot com
Thanks for response. I'm not asking for help - as noted:
1. Problem is in the extension php_curl.dll;
2. Problem only started after certain commit - affecting all 5.x versions after certain date (you can check date=version)..
3. Problem by it self is that in those later versions - constant `CURLPROTO_HTTPS` isn't handled properly.

The rest of info is just to confirm that this problem started after certain commint/version and not in php core, but extension...
 [2016-05-07 08:34 UTC] megamurmulis at gmail dot com
@pierrick@php.net - You are right, this was simple mixup of "|" and "or" (resulting in value of '1', not '3').

And only reason why this was overlooked so long - older php_curl extension seems to have permitted HTTPS even when only HTTP was allowed, hence the appearance of "bug" appearing only after certain version.

Problem solved.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 18:01:24 2019 UTC