[php-src] PHP-8.4: Fix calling conventions in Windows alertable sleep test (#25125)
| From: | Shivam Mathur via GitHub | Date: | Sun, 01 Nov 2026 12:58:38 +0000 |
| Subject: | [php-src] PHP-8.4: Fix calling conventions in Windows alertable sleep test (#25125) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143138@lists.php.net to get a copy of this message | ||
Author: Shivam Mathur (shivammathur)
Committer: GitHub (web-flow)
Pusher: shivammathur
Date: 2026-11-01T18:28:34+05:30
Commit: https://github.com/php/php-src/commit/4dd9bb4dc6d0c09ecde2341fc7ae1edf0967d40e
Raw diff: https://github.com/php/php-src/commit/4dd9bb4dc6d0c09ecde2341fc7ae1edf0967d40e.diff
Fix calling conventions in Windows alertable sleep test (#25125)
Place __stdcall outside the function-pointer parentheses, where FFI applies it to the function type.
The nested placement is ignored and creates a cdecl APC callback, corrupting the Windows dispatcher
stack on x86.
Changed paths:
M ext/standard/tests/general_functions/sleep_alertable_win32.phpt
Diff:
diff --git a/ext/standard/tests/general_functions/sleep_alertable_win32.phpt
b/ext/standard/tests/general_functions/sleep_alertable_win32.phpt
index 55da154ccf75..33e08ed844b0 100644
--- a/ext/standard/tests/general_functions/sleep_alertable_win32.phpt
+++ b/ext/standard/tests/general_functions/sleep_alertable_win32.phpt
@@ -19,10 +19,10 @@ $kernel32 = FFI::cdef(<<<C
unsigned long SleepEx(unsigned long milliseconds, int alertable);
C, 'kernel32.dll');
$ffi = FFI::cdef(<<<C
- typedef void ($callconv *PAPCFUNC)(uintptr_t);
- typedef void *($callconv *GetCurrentThread_t)(void);
- typedef unsigned long ($callconv *QueueUserAPC_t)(PAPCFUNC callback, void *thread, uintptr_t
data);
- typedef unsigned long ($callconv *SleepEx_t)(unsigned long milliseconds, int alertable);
+ typedef void $callconv (*PAPCFUNC)(uintptr_t);
+ typedef void *$callconv (*GetCurrentThread_t)(void);
+ typedef unsigned long $callconv (*QueueUserAPC_t)(PAPCFUNC callback, void *thread, uintptr_t
data);
+ typedef unsigned long $callconv (*SleepEx_t)(unsigned long milliseconds, int alertable);
C);
$GetCurrentThread = $ffi->cast('GetCurrentThread_t', $kernel32->GetCurrentThread);
$QueueUserAPC = $ffi->cast('QueueUserAPC_t', $kernel32->QueueUserAPC);