xref: /PHP-8.1/ext/ffi/tests/300.phpt (revision 75970077)
1--TEST--
2FFI 300: FFI preloading
3--EXTENSIONS--
4ffi
5opcache
6posix
7--SKIPIF--
8<?php
9if (substr(PHP_OS, 0, 3) == 'WIN') die('skip not for Windows');
10if (ini_get('opcache.preload_user')) die('skip FFI::load() does not support opcache.preload_user');
11if (posix_geteuid() == 0) die('skip Cannot run test as root.');
12?>
13--INI--
14ffi.enable=1
15opcache.enable=1
16opcache.enable_cli=1
17opcache.optimization_level=-1
18opcache.preload={PWD}/preload.inc
19opcache.file_cache_only=0
20--FILE--
21<?php
22$ffi = FFI::scope("TEST_300");
23$ffi->printf("Hello World from %s!\n", "PHP");
24?>
25--EXPECT--
26Hello World from PHP!
27