Bug #78891 [Com]: Bug with CURL completely stopped working

From: Date: Mon, 02 Dec 2019 02:30:13 +0000
Subject: Bug #78891 [Com]: Bug with CURL completely stopped working
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223996@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78891&edit=1

 ID:                 78891
 Comment by:         gilperon at gmail dot com
 Reported by:        gilperon at gmail dot com
 Summary:            Bug with CURL completely stopped working
 Status:             Feedback
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   all
 PHP Version:        7.2.25
 Block user comment: N
 Private report:     N

 New Comment:

One more thing, I tried using the CART file from https://curl.haxx.se/ca/cacert.pem and it also does
show the same exactly error, so I am pretty cure there is no problem with cacert or certificate
bundle.


Previous Comments:
------------------------------------------------------------------------
[2019-12-01 14:17:20] gilperon at gmail dot com

nikic@php.net I just woke up right now and went to try your code and suddenly this bug went away. I
didnt make ANY update yesterday. I didnt do "yum update" and for some reason CURL came
back to work!

Then I tried adding the line of code -
mysqli_connect("localhost","root","password") - above the CURL and
then it crashed  again. Which means that the bug that I reported a few days back came back to happen
again.

So now, CURL only does not work when opening the mysqli connection.

Nikik I tried that 2 line of codes you asked me and the output follows below:

CODE:

<?php

$conn = mysqli_connect("localhost","root","password");

$curl = curl_init();

$opts = array();

$opts[CURLOPT_URL] = "https://www.sitepor500.com.br";

$opts[CURLOPT_RETURNTRANSFER] = true;

curl_setopt_array($curl,$opts);


var_dump(curl_exec($curl));

var_dump(curl_errno($curl))

?>

OUTPUT

bool(false)
int(77)

I investigated, and 77 means -> CURLE_SSL_CACERT_BADFILE.

ALSO one even strange thing, if I replace 

$conn = mysqli_connect("localhost","root","password"); 

with just

mysqli_connect("localhost","root","password");

The bug goes away and everything works! 

Hope this helps and if you want me to execute any other code, I am here to help!

------------------------------------------------------------------------
[2019-12-01 12:25:32] nikic@php.net

It's pretty weird that curl_error() doesn't report anything here. Just to double check, if
you replace the "echo curl_exec($curl)" with "var_dump(curl_exec($curl))", do
you get "bool(false)" or "string(0)"? And afterwards, does
"var_dump(curl_errno($curl))" give "int(0)" as well?

------------------------------------------------------------------------
[2019-11-30 17:14:40] gilperon at gmail dot com

One more note: using "echo curl_error($curl); " shows a blank string! So curl is not
showing any error.

------------------------------------------------------------------------
[2019-11-30 17:10:48] gilperon at gmail dot com

I just forgot to say that when I open my Centos terminal and execute the command below, everything
works fine:

curl https://www.sitepor500.com.br

So, using curl directly from the terminal, works fine. Only using it with PHP is that gets buggy.

------------------------------------------------------------------------
[2019-11-30 17:06:48] gilperon at gmail dot com

nikic@php.net thanks for your attention. I can easily reproduce this bug installing LAMP on a CENTOS
7 new server on Linode. Just fire a cloud server, install lamp with PHP using 7.2.25 and the bug
happens.

Using file_get_contents the bug does not happen. Only with CURL. Also, the CURL code that I provided
you, does not return any error, just an empty string when the requested domain contains HTTPS
protocol. 

There is no error reported at error_log of Apache!

Regarding the version of the libcurl I executed the code "var_dump( curl_version() );" and
I got this:



array(9) {
  ["version_number"]=>
  int(466176)
  ["age"]=>
  int(3)
  ["features"]=>
  int(558781)
  ["ssl_version_number"]=>
  int(0)
  ["version"]=>
  string(6) "7.29.0"
  ["host"]=>
  string(23) "x86_64-redhat-linux-gnu"
  ["ssl_version"]=>
  string(8) "NSS/3.36"
  ["libz_version"]=>
  string(5) "1.2.7"
  ["protocols"]=>
  array(20) {
    [0]=>
    string(4) "dict"
    [1]=>
    string(4) "file"
    [2]=>
    string(3) "ftp"
    [3]=>
    string(4) "ftps"
    [4]=>
    string(6) "gopher"
    [5]=>
    string(4) "http"
    [6]=>
    string(5) "https"
    [7]=>
    string(4) "imap"
    [8]=>
    string(5) "imaps"
    [9]=>
    string(4) "ldap"
    [10]=>
    string(5) "ldaps"
    [11]=>
    string(4) "pop3"
    [12]=>
    string(5) "pop3s"
    [13]=>
    string(4) "rtsp"
    [14]=>
    string(3) "scp"
    [15]=>
    string(4) "sftp"
    [16]=>
    string(4) "smtp"
    [17]=>
    string(5) "smtps"
    [18]=>
    string(6) "telnet"
    [19]=>
    string(4) "tftp"
  }
}

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=78891


--
Edit this bug report at https://bugs.php.net/bug.php?id=78891&edit=1


Thread (16 messages)

« previous php.bugs (#223996) next »