Bug #77264 [Ver]: curl_getinfo returning microseconds, not seconds

From: Date: Sat, 08 Dec 2018 15:42:36 +0000
Subject: Bug #77264 [Ver]: curl_getinfo returning microseconds, not seconds
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218341@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77264&edit=1 ID: 77264 Updated by: pierrick@php.net Reported by: chris at lodesys dot com Summary: curl_getinfo returning microseconds, not seconds Status: Verified Type: Bug Package: cURL related Operating System: Windows PHP Version: 7.3.0 Assigned To: pierrick Block user comment: N Private report: N New Comment: Sorry about this I went to fast. It's my mistake. I'll commit a fix for this soon. Previous Comments: ------------------------------------------------------------------------ [2018-12-08 10:34:26] cmb@php.net If libcurl ≥ 7.61.0 is available, the times are indeed given as int in microseconds[1]; for older libcurl they are floats in seconds[2]. Is this intentional, Pierrick? If so, we have to prominently document the change in UPGRADING and the migration guide etc. However, it might be better to introduce new array elements (e.g. total_time_us) instead of overwriting the old ones for BC reasons. [1] <https://github.com/php/php-src/blob/php-7.3.0/ext/curl/interface.c#L3341-L3343> [2] <https://github.com/php/php-src/blob/php-7.3.0/ext/curl/interface.c#L3217-L3219> ------------------------------------------------------------------------ [2018-12-07 18:56:21] chris at lodesys dot com Description: ------------ Under PHP 7.3.0, cURL appears to be returning times in microseconds instead of seconds. Running PHP executables downloaded from from http://windows.php.net The following example is from the curl_getinfo documentation page -- https://secure.php.net/manual/en/function.curl-getinfo.php Test script: --------------- <?php // Create a cURL handle $ch = curl_init('http://www.example.com/'); // Execute curl_exec($ch); // Check if any error occurred if (!curl_errno($ch)) { $info = curl_getinfo($ch); echo 'Took ', $info['total_time'], ' seconds to send a request to ', $info['url'], "\n"; } // Close handle curl_close($ch); ?> Expected result: ---------------- The expected result is less than 0.5 seconds "to send a request". This is what I'm seeing when running this script with PHP 7.2.12 Actual result: -------------- I'm getting values like 110000 seconds "to send a request" (30.5 hours). Same script run with PHP 7.3.0 Have the same microseconds-not-seconds problem with all the time values Total_Time Namelookup_Time Connect_Time Pretransfer_Time Starttransfer_Time ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77264&edit=1

« previous php.bugs (#218341) next »