summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-19 10:03:29 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-02-19 10:03:29 +0100
commit293313cc48d356d90b43503af1a6f2fd013c4b64 (patch)
tree5d185b39c02ceaa791598cf9159fd41b893fa954
parentfec954de7bb4d860be25f9399934ac2f0993fb8f (diff)
parentcdfe11f80d5affd6d5386d84dff0d81323b60bc4 (diff)
downloadphp-git-293313cc48d356d90b43503af1a6f2fd013c4b64.tar.gz
Merge branch 'PHP-7.4'
-rw-r--r--ext/ffi/tests/bug77632.phpt9
-rw-r--r--ext/ffi/tests/bug77632b.phpt24
2 files changed, 32 insertions, 1 deletions
diff --git a/ext/ffi/tests/bug77632.phpt b/ext/ffi/tests/bug77632.phpt
index ebaf3dccf9..314424548a 100644
--- a/ext/ffi/tests/bug77632.phpt
+++ b/ext/ffi/tests/bug77632.phpt
@@ -1,7 +1,14 @@
--TEST--
Bug #77632 (FFI Segfaults When Called With Variadics)
--SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+try {
+ $libc = FFI::cdef("int printf(const char *format, ...);", "libc.so.6");
+} catch (Throwable $_) {
+ die('skip libc.so.6 not available');
+}
+?>
--INI--
ffi.enable=1
--FILE--
diff --git a/ext/ffi/tests/bug77632b.phpt b/ext/ffi/tests/bug77632b.phpt
new file mode 100644
index 0000000000..a988306745
--- /dev/null
+++ b/ext/ffi/tests/bug77632b.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #77632 (FFI function pointers with variadics)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+try {
+ FFI::cdef("extern void *zend_printf;");
+} catch (Throwable $_) {
+ die('skip PHP symbols not available');
+}
+?>
+--INI--
+ffi.enable=1
+--FILE--
+<?php
+$libc = FFI::cdef("extern size_t (*zend_printf)(const char *format, ...);");
+$args = ["test from zend_printf\n"];
+($libc->zend_printf)(...$args);
+$args2 = ["Hello, %s from zend_printf\n", "world"];
+($libc->zend_printf)(...$args2);
+?>
+--EXPECT--
+test from zend_printf
+Hello, world from zend_printf