Bug #79033 [Csd]: Curl timeout error with specific url and post
| From: | cmb@php.net | Date: | Sat, 28 Dec 2019 15:17:05 +0000 |
| Subject: | Bug #79033 [Csd]: Curl timeout error with specific url and post | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224574@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79033&edit=1
ID: 79033
Updated by: cmb@php.net
Reported by: dav dot tur19 at gmail dot com
Summary: Curl timeout error with specific url and post
Status: Closed
Type: Bug
Package: cURL related
Operating System: linux/windows
PHP Version: 7.4.1
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Yes, I've also checked with the given test script, and that
returned "success" with the fix. You can verify with
<https://windows.php.net/downloads/snaps/php-7.4/r6d1dff6/>.
Previous Comments:
------------------------------------------------------------------------
[2019-12-28 14:53:20] dav dot tur19 at gmail dot com
have you checked the test file? the problem seemed to occur only on that specific url
(https://api.telegram.org/bot12341234:WASDWASD/getMe), I couldn't even reproduce it on my
webserver by setting 401 as http code and some other header.
------------------------------------------------------------------------
[2019-12-28 09:50:47] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c47b18a222ceb1d78810d2822170cbf6e110a98c
Log: Fix #79033: Curl timeout error with specific url and post
------------------------------------------------------------------------
[2019-12-27 21:58:13] cmb@php.net
This regression has been introduced with commit a83b68b[1].
[1] <http://git.php.net/?p=php-src.git;a=commit;h=a83b68ba56714bfa06737a61af795460caa4a105>
------------------------------------------------------------------------
[2019-12-26 01:07:15] dav dot tur19 at gmail dot com
Description:
------------
If an empty array is set to CURLOPT_POSTFIELDS, the request will timeout, this does not happen on
php7.3 or with CURLOPT_POSTFIELDS with other values.
The problem occurs on both windows and linux.
Test script:
---------------
<?php
$token = '12341234:WASDWASD';
$method = 'getMe';
$args = [];
$curlRequestSession = curl_init();
curl_setopt_array($curlRequestSession, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_TIMEOUT => 3,
CURLOPT_URL => 'https://api.telegram.org/bot' . $token .
'/' . $method,
CURLOPT_POSTFIELDS => $args,
]);
$response = curl_exec($curlRequestSession);
if($response === false) {
echo curl_error($curlRequestSession) . PHP_EOL . var_export(curl_getinfo($curlRequestSession),
true) . PHP_EOL;
} else {
echo 'Success: ' . $response . PHP_EOL;
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79033&edit=1