Skip to content

Commit 93b9808

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: NEWS for hrtime in FTP and standard Handle broken hrtime in ftp Fix arginfo/zpp violation if zend_hrtime is not available
2 parents 7777eaa + 802e348 commit 93b9808

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ext/ftp/ftp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,8 @@ static int my_poll(php_socket_t fd, int events, int timeout) {
13821382

13831383
if (n == -1 && php_socket_errno() == EINTR) {
13841384
zend_hrtime_t delta_ns = zend_hrtime() - start_ns;
1385-
if (delta_ns > timeout_hr) {
1385+
/* delta_ns == 0 is only possible with a platform that does not support a high-res timer. */
1386+
if (delta_ns > timeout_hr || UNEXPECTED(delta_ns == 0)) {
13861387
#ifndef PHP_WIN32
13871388
errno = ETIMEDOUT;
13881389
#endif

ext/standard/hrtime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
delivered timestamp is monotonic and cannot be adjusted. */
4747
PHP_FUNCTION(hrtime)
4848
{
49-
#if ZEND_HRTIME_AVAILABLE
5049
bool get_as_num = 0;
5150
zend_hrtime_t t = zend_hrtime();
5251

@@ -55,6 +54,7 @@ PHP_FUNCTION(hrtime)
5554
Z_PARAM_BOOL(get_as_num)
5655
ZEND_PARSE_PARAMETERS_END();
5756

57+
#if ZEND_HRTIME_AVAILABLE
5858
if (UNEXPECTED(get_as_num)) {
5959
PHP_RETURN_HRTIME(t);
6060
} else {

0 commit comments

Comments
 (0)