Bug #62890 [Asn->Csd]: default_socket_timeout=-1 causes connection to timeout

From: Date: Tue, 09 Jun 2020 14:49:24 +0000
Subject: Bug #62890 [Asn->Csd]: default_socket_timeout=-1 causes connection to timeout
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227379@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62890&edit=1 ID: 62890 Updated by: cmb@php.net Reported by: fallingdust at gmail dot com Summary: default_socket_timeout=-1 causes connection to timeout -Status: Assigned +Status: Closed Type: Bug Package: OpenSSL related Operating System: Mac Lion 10.7.4 PHP Version: 7.3 Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=eadd98070662f0c56d7138bcb2a42d397c11f6e4 Log: Fix #62890: default_socket_timeout=-1 causes connection to timeout Previous Comments: ------------------------------------------------------------------------ [2020-06-09 11:38:08] cmb@php.net The following pull request has been associated: Patch Name: Fix #62890: default_socket_timeout=-1 causes connection to timeout On GitHub: https://github.com/php/php-src/pull/5693 Patch: https://github.com/php/php-src/pull/5693.patch ------------------------------------------------------------------------ [2020-06-09 09:23:55] cmb@php.net I can confirm that with default_socket_timeout=-1, file_get_contents('http://www.google.com') succeeds, but file_get_contents('https://www.google.com') fails. Apparently, some code paths ignore negative timeouts by special casing them[1], and others don't. [1] <https://github.com/php/php-src/blob/PHP-7.3/main/network.c#L1243> ------------------------------------------------------------------------ [2018-07-01 18:04:46] jose dot nobile at gmail dot com It is reproducible on Linux (Centos 6.9/CloudLinux). I need set it to -1 because Redis:brpoplpush timeout each minute (The default socket timeout value is 60 secs), but file_get_contents fail with file_get_contents(): SSL: Handshake timed out, file_get_contents(): Failed to enable crypto, file_get_contents(https://someExampledomain.tld): failed to open stream: operation failed. I have to set ['http' => ['timeout' => 10]] via stream_context_create to make it works. Tested in PHP 7.2.7 ------------------------------------------------------------------------ [2016-04-26 16:52:56] pembo at neonerve dot com This appears to only be an issue on Macs. When using it on Windows / Linux it performs as expected. ------------------------------------------------------------------------ [2012-08-22 10:25:06] fallingdust at gmail dot com Description: ------------ --- From manual page: http://www.php.net/filesystem.configuration --- php.ini configuration: allow_url_fopen = On allow_url_include = Off ;from="john@doe.com" ;user_agent="PHP" default_socket_timeout = 60 ;auto_detect_line_endings = Off Test script: --------------- php -r 'ini_set("default_socket_timeout", -1); echo file_get_contents("http://www.google.com");' Expected result: ---------------- print the html of google page. Actual result: -------------- PHP Warning: file_get_contents(http://www.google.com): failed to open stream: Operation now in progress in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 PHP 2. file_get_contents() Command line code:1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62890&edit=1

« previous php.bugs (#227379) next »