Commit 4dd9bb4dc6d for php
commit 4dd9bb4dc6d0c09ecde2341fc7ae1edf0967d40e
Author: Shivam Mathur <shivam_jpr@hotmail.com>
Date: Sun Nov 1 18:28:34 2026 +0530
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.
diff --git a/ext/standard/tests/general_functions/sleep_alertable_win32.phpt b/ext/standard/tests/general_functions/sleep_alertable_win32.phpt
index 55da154ccf7..33e08ed844b 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 @@
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);