Skip to content

Commit 802e348

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

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Fixed bug GH-18581 (Coerce numeric string keys from iterators when argument
1313
unpacking). (ilutov)
1414

15+
- FTP:
16+
. Fix theoretical issues with hrtime() not being available. (nielsdos)
17+
1518
- Hash:
1619
. Fix crash on clone failure. (nielsdos)
1720

@@ -41,6 +44,7 @@ PHP NEWS
4144
- Standard:
4245
. Fixed OSS Fuzz #433303828 (Leak in failed unserialize() with opcache).
4346
(ilutov)
47+
. Fix theoretical issues with hrtime() not being available. (nielsdos)
4448

4549
31 Jul 2025, PHP 8.4.11
4650

ext/ftp/ftp.c

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

14921492
if (n == -1 && php_socket_errno() == EINTR) {
14931493
zend_hrtime_t delta_ns = zend_hrtime() - start_ns;
1494-
if (delta_ns > timeout_hr) {
1494+
/* delta_ns == 0 is only possible with a platform that does not support a high-res timer. */
1495+
if (delta_ns > timeout_hr || UNEXPECTED(delta_ns == 0)) {
14951496
#ifndef PHP_WIN32
14961497
errno = ETIMEDOUT;
14971498
#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)