com php-src: Fix ffi test on Windows: ext/ffi/tests/bug77632.phpt ext/ffi/tests/bug77632b.phpt

From: Date: Tue, 19 Feb 2019 09:03:14 +0000
Subject: com php-src: Fix ffi test on Windows: ext/ffi/tests/bug77632.phpt ext/ffi/tests/bug77632b.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-104717@lists.php.net to get a copy of this message
Commit: cdfe11f80d5affd6d5386d84dff0d81323b60bc4 Author: Tyson Andre <tysonandre775@hotmail.com> Mon, 18 Feb 2019 11:47:09 -0500 Committer: Nikita Popov <nikita.ppv@gmail.com> Tue, 19 Feb 2019 10:03:14 +0100 Parents: 24433e9d25d410418713c479a675dc92e6a036ae Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cdfe11f80d5affd6d5386d84dff0d81323b60bc4 Log: Fix ffi test on Windows Fixes a bug in test added in 5661feb1ef929111ef7765672fcb49813eee86fc, by checking that the relevant SO exists. Also adds an additional test that is based on zend_printf, and should work on both Linux and Windows. Changed paths: M ext/ffi/tests/bug77632.phpt A ext/ffi/tests/bug77632b.phpt Diff: diff --git a/ext/ffi/tests/bug77632.phpt b/ext/ffi/tests/bug77632.phpt index ebaf3dc..3144245 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 0000000..a988306 --- /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

« previous php.cvs (#104717) next »