Skip to content

Commit 272da51

Browse files
windaishiarnaud-lb
authored andcommitted
Use ITIMER_REAL for timeout handling on MacOS / Apple Silicon system
setitimer(ITIMER_PROF) fires too early on MacOS 14 when running on Apple Silicon. See https://openradar.appspot.com/radar?id=5583058442911744. Fixes GH-12814 Closes GH-13567
1 parent 48ae025 commit 272da51

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ PHP NEWS
44

55
- Core:
66
. Fixed bug GH-14315 (Incompatible pointer type warnings). (Peter Kokot)
7+
. Fixed bug GH-12814 (max_execution_time reached too early on MacOS 14
8+
when running on Apple Silicon). (Manuel Kress)
79

810
- Curl:
911
. Fixed bug GH-14307 (Test curl_basic_024 fails with curl 8.8.0). (nielsdos)

Zend/zend_execute_API.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,9 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */
15331533
t_r.it_value.tv_sec = seconds;
15341534
t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
15351535

1536-
# if defined(__CYGWIN__) || defined(__PASE__)
1536+
# if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__))
1537+
// ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14
1538+
// See https://openradar.appspot.com/radar?id=5583058442911744.
15371539
setitimer(ITIMER_REAL, &t_r, NULL);
15381540
}
15391541
signo = SIGALRM;
@@ -1597,7 +1599,7 @@ void zend_unset_timeout(void) /* {{{ */
15971599

15981600
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
15991601

1600-
# if defined(__CYGWIN__) || defined(__PASE__)
1602+
# if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__))
16011603
setitimer(ITIMER_REAL, &no_timeout, NULL);
16021604
# else
16031605
setitimer(ITIMER_PROF, &no_timeout, NULL);

0 commit comments

Comments
 (0)