1--TEST--
2Curlinfo CURLINFO_POSTTRANSFER_TIME_T
3--EXTENSIONS--
4curl
5--SKIPIF--
6<?php
7$curl_version = curl_version();
8if ($curl_version['version_number'] < 0x080a00) die("skip: test works only with curl >= 8.10.0");
9?>
10--FILE--
11<?php
12include 'server.inc';
13
14$host = curl_cli_server_start();
15$port = (int) (explode(':', $host))[1];
16
17$ch = curl_init();
18curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc?test=file");
19curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
20
21$info = curl_getinfo($ch);
22var_dump(isset($info['posttransfer_time_us']));
23var_dump($info['posttransfer_time_us'] === 0); // this is always 0 before executing the transfer
24
25$result = curl_exec($ch);
26
27$info = curl_getinfo($ch);
28var_dump(isset($info['posttransfer_time_us']));
29var_dump(is_int($info['posttransfer_time_us']));
30var_dump(curl_getinfo($ch, CURLINFO_POSTTRANSFER_TIME_T) === $info['posttransfer_time_us']);
31var_dump(curl_getinfo($ch, CURLINFO_POSTTRANSFER_TIME_T) > 0);
32
33?>
34--EXPECT--
35bool(true)
36bool(true)
37bool(true)
38bool(true)
39bool(true)
40bool(true)
41
42