php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76438 wrong curl_getinfo time values
Submitted: 2018-06-09 20:31 UTC Modified: 2021-10-03 04:22 UTC
Votes:4
Avg. Score:3.8 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: example1 at example2 dot com Assigned: cmb (profile)
Status: No Feedback Package: cURL related
PHP Version: Irrelevant OS: Windows 7.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
17 - 11 = ?
Subscribe to this entry?

 
 [2018-06-09 20:31 UTC] example1 at example2 dot com
Description:
------------
curl_getinfo sometimes returns very big time values.
4295.139296, 4295.310296 and 4295.295296 are very frequent (about 57%).
All I have spotted were of format 4295.***296 .
Apache/2.4.27 (Win64) PHP/7.1.9.

Test script:
---------------
<?php
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, 'http://example.com');
	curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
	curl_setopt($curl, CURLOPT_TIMEOUT, 15);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_exec($curl);
	$info = curl_getinfo($curl);
	
	echo 'total_time = ' . $info['total_time'] . '<br>';
	echo 'namelookup_time = ' . $info['namelookup_time'] . '<br>';
	echo 'connect_time = ' . $info['connect_time'] . '<br>';
	echo 'pretransfer_time = ' . $info['pretransfer_time'] . '<br>';
	echo 'starttransfer_time = ' . $info['starttransfer_time'] . '<br>';
	echo 'redirect_time = ' . $info['redirect_time'] . '<br>';
	curl_close($curl);
?>

Expected result:
----------------
typical normal result:

total_time = 0.327
namelookup_time = 1.0E-6
connect_time = 0.171
pretransfer_time = 0.171
starttransfer_time = 0.327
redirect_time = 0

Actual result:
--------------
total_time = 4295.326296
namelookup_time = 0.015
connect_time = 4295.154296
pretransfer_time = 4295.154296
starttransfer_time = 4295.326296
redirect_time = 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 14:52 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2019-03-26 14:52 UTC] mike@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2019-04-07 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2019-05-08 15:56 UTC] ax2002 at gmx dot net
Hi there,

I would like to reopen this bug because I had the same problem. And tried to find out more details about it.

I have a XAMPP installation in Windows 10.

Apache httpd: 2.4.37 Win32
PHP-version: 7.3.0 
Curl-lib: 7.57.0 


If I use PHP as module mod_php the curl_getinfo($curl) shows the correct time in "total_time".

If I use Php as *fcgi* the "total_time" looks like the time in ms x 1000. Other time values (i.e. starttransfer_time) shaow the same behaviour.

Example:
If the time should be something like 16 ms then "total_time" contains 
- 0.016 with mod_php (what is correct)
- 16000 in fcgi (factor 1000)

For the test I use the same install directory with the same binaries of Apache, PHP and its modules. I only switched the kind of php usage by config (httpd.conf). 

The problem seems to be the fcgi mode. Maybe on MS Windows only (I did not tested it on another platform).

Regards,
Axel
 [2019-05-08 16:54 UTC] requinix@php.net
-Status: No Feedback +Status: Re-Opened
 [2021-09-21 14:21 UTC] cmb@php.net
I cannot reproduce this with PHP-7.4 using cURL 7.70.0 with Apache
2.4 on Windows (mod_php as well as FCGI show sound values).  Can
anybody else still reproduce this with any of the actively
supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-09-24 10:56 UTC] cmb@php.net
-Status: Re-Opened +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-10-03 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC