[php-src] PR #25126: Fix FFI calling conventions inside nested declarators
| From: | nicolas-grekas | Date: | Sun, 01 Nov 2026 13:14:03 +0000 |
| Subject: | [php-src] PR #25126: Fix FFI calling conventions inside nested declarators | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40183@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25126
Author: nicolas-grekas
FFI ignores the calling convention in
void (__stdcall *f)(void). That's how
Windows headers declare callbacks, for example PAPCFUNC. On x86, such a callback is
created as cdecl. The callback then doesn't pop its argument and the stdcall caller crashes.
That's why sleep_alertable_win32.phpt from #24399 crashes on nightly (#25125
changes the test).
In a parameter or a type name, as in FFI::type('void (__stdcall *)(int)'),
the same syntax fails with "Unsupported type specifier combination".
A convention that the platform doesn't support is now rejected inside the parentheses too, like
it already is before them. For example, void (__stdcall *f)(void) now throws on x64.
I updated ffi_parser.c by hand, the same way LLK generates the other cases.