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