|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-08-29 08:15 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2019-08-29 08:15 UTC] cmb@php.net
[2019-08-29 08:15 UTC] cmb@php.net
[2019-08-29 21:29 UTC] ojrask at gmail dot com
[2019-08-30 09:28 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 07:00:01 2025 UTC |
Description: ------------ When I attempt to use `\FFI::scope()` in CLI scripts (no preloading and all that jazz), I get an error saying PHP Fatal error: Uncaught FFI\Exception: Failed loading scope 'FOO' in ... The stack trace reveals no reasons. I would presume scopes are OK to be used in CLI SAPI, or then there is some documentation missing as to why it is not possible. Test script: --------------- <?php declare(strict_types = 1); $header = <<<'HEA' #define FFI_SCOPE "FOO" #define FFI_LIB "libc.so.6" void printf(char *const str, ...); 'HEA'; file_put_contents(__DIR__ . '/header.h', $header); \FFI::load(__DIR__ . '/header.h'); $ffi = \FFI::scope('FOO'); $ffi->printf('Hello %s!', 'world'); Expected result: ---------------- Output should be Hello world! Actual result: -------------- Output is PHP Fatal error: Uncaught FFI\Exception: Failed loading scope 'FOO' in .../hello-world.php:14 Stack trace: #0 .../hello-world.php(14): FFI::scope() #1 {main} thrown in .../hello-world.php on line 14