Bug #80851 [Opn->Csd]: https doesn't respect stream context option http.timeout -1
| From: | athorcis at yahoo dot fr | Date: | Wed, 10 Mar 2021 15:17:15 +0000 |
| Subject: | Bug #80851 [Opn->Csd]: https doesn't respect stream context option http.timeout -1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232651@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80851&edit=1
ID: 80851
User updated by: athorcis at yahoo dot fr
Reported by: athorcis at yahoo dot fr
Summary: https doesn't respect stream context option
http.timeout -1
-Status: Open
+Status: Closed
Type: Bug
Package: HTTP related
Operating System: ALL
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
-
Previous Comments:
------------------------------------------------------------------------
[2021-03-10 15:15:47] athorcis at yahoo dot fr
my bad, the bug was fixed last summer but I was testing with PHP-7.4.6 which is why I experienced
the problem (https://github.com/php/php-src/commit/eadd98070662f0c56d7138bcb2a42d397c11f6e4)
------------------------------------------------------------------------
[2021-03-10 14:51:27] athorcis at yahoo dot fr
It is not documented directly but http.timeout uses default_socket_timeout as a default value and
default_socket_timeout allow negative values as specified here https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout
------------------------------------------------------------------------
[2021-03-10 14:26:44] cmb@php.net
I cannot reproduce this on Windows with PHP-7.4.
> The options http.timeout -1 si suppose to prevent timeout errors
> not cause them
While this apparently a valid assumption[1], it is not documented
in the PHP manual.
[1] <https://github.com/php/php-src/blob/php-7.4.16/ext/openssl/xp_ssl.c#L1955>
------------------------------------------------------------------------
[2021-03-10 12:56:15] athorcis at yahoo dot fr
Description:
------------
When trying to access an HTTPS URL through streams if the HTTP timeout is set to a negative value
then the function fails with the following warnings:
Warning: file_get_contents(): SSL: Handshake timed out in Command line code on line 1
Warning: file_get_contents(): Failed to enable crypto in Command line code on line 1
Warning: file_get_contents(https://www.google.fr/): failed to open stream: operation failed in
Command line code on line 1
I reproduced the error on Debian but also on Windows using these versions: 5.4, 5.5, 5.6 and 7.4
Test script:
---------------
file_get_contents('https://www.google.fr/',
false, stream_context_create(['http' => ['timeout' => -1]]));
Expected result:
----------------
The options http.timeout -1 si suppose to prevent timeout errors not cause them
Actual result:
--------------
The options http.timeout -1 cause an a timeout error with https streams
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80851&edit=1