xref: /PHP-8.2/ext/ffi/tests/bug77632b.phpt (revision bd9f4fa6)
1--TEST--
2Bug #77632 (FFI function pointers with variadics)
3--EXTENSIONS--
4ffi
5--SKIPIF--
6<?php
7require_once('utils.inc');
8try {
9    FFI::cdef("extern void *zend_printf;", ffi_get_php_dll_name());
10} catch (Throwable $_) {
11    die('skip PHP symbols not available');
12}
13?>
14--INI--
15ffi.enable=1
16--FILE--
17<?php
18require_once('utils.inc');
19$libc = FFI::cdef("extern size_t (*zend_printf)(const char *format, ...);", ffi_get_php_dll_name());
20$args = ["test from zend_printf\n"];
21($libc->zend_printf)(...$args);
22$args2 = ["Hello, %s from zend_printf\n", "world"];
23($libc->zend_printf)(...$args2);
24?>
25--EXPECT--
26test from zend_printf
27Hello, world from zend_printf
28