Bug #78845 [Opn->Fbk]: mysqli_connect() causes malfunctions of curl
| From: | cmb@php.net | Date: | Tue, 26 Nov 2019 10:48:41 +0000 |
| Subject: | Bug #78845 [Opn->Fbk]: mysqli_connect() causes malfunctions of curl | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223892@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78845&edit=1
ID: 78845
Updated by: cmb@php.net
Reported by: gilperon at gmail dot com
Summary: mysqli_connect() causes malfunctions of curl
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Centos 7
PHP Version: 7.2.24
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> This should be solved on 7.2.5 with Nikita's patch [â¦]
Ah, good catch! It's 7.2.25, though.
@gilperon, can you please try with a current Git snapshot?
Previous Comments:
------------------------------------------------------------------------
[2019-11-25 16:02:41] lcobucci@php.net
This should be solved on 7.2.5 with Nikita's patch http://git.php.net/?p=php-src.git;a=commit;h=4f984a2fdb3815361f83013c23af0ff5d6d63d67
of bug #78775
------------------------------------------------------------------------
[2019-11-21 12:23:36] gilperon at gmail dot com
Guys I think it has something related to SSL!
On the test code I provided you if you change https://www.sitepor500.com.br to any domain that DOES NOT
have SSL it will work. Try changing https://www.sitepor500.com.br to any domain that does not
force https redirection and the bug goes away.
So it clearly only happen when the destination domain uses SSL.
note: this bug does not happen when using
file_get_contents.
------------------------------------------------------------------------
[2019-11-20 22:45:29] cmb@php.net
This might be related to bug #78824.
------------------------------------------------------------------------
[2019-11-20 22:36:29] gilperon at gmail dot com
Description:
------------
Hi,
I have found a very serious and easy to reproduce bug happening with CURL on latest PHP 7.2.X (which
is 7.2.24).
Just run the code below on your server running PHP+APACHE+MARIADB:
<?php
$curl = curl_init();
$opts = array();
$opts[CURLOPT_URL] = "https://www.sitepor500.com.br";
curl_setopt_array($curl,$opts);
echo curl_exec($curl);
?>
It will work just fine, I mean, you will see the contents of the page on CURLOPT_URL. Now JUST ADD
one single line of code to it and the bug will happen:
<?php
$conn = mysqli_connect("localhost","root","your_password");
$curl = curl_init();
$opts = array();
$opts[CURLOPT_URL] = "https://www.sitepor500.com.br";
curl_setopt_array($curl,$opts);
echo curl_exec($curl);
?>
Incredibly, just adding a connection to a local database will make CURL fetch the content of the URL
specified at CURLOPT_URL as "" (empty string). This happens with any URL.
Test script:
---------------
<?php
$conn = mysqli_connect("localhost","root","your_password");
$curl = curl_init();
$opts = array();
$opts[CURLOPT_URL] = "https://www.sitepor500.com.br";
curl_setopt_array($curl,$opts);
echo curl_exec($curl);
?>
Expected result:
----------------
You should see the URL content
Actual result:
--------------
Nothing is shown
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78845&edit=1