Bug #78474 [NEW]: FFI::scope does not work in CLI SAPI

From: Date: Thu, 29 Aug 2019 08:00:21 +0000
Subject: Bug #78474 [NEW]: FFI::scope does not work in CLI SAPI
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222478@lists.php.net to get a copy of this message
From: ojrask at gmail dot com Operating system: Ubuntu 18.04 PHP version: 7.4.0beta4 Package: Unknown/Other Function Bug Type: Bug Bug description:FFI::scope does not work in CLI SAPI 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 -- Edit bug report at https://bugs.php.net/bug.php?id=78474&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78474&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78474&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78474&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78474&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78474&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78474&r=support Expected behavior: https://bugs.php.net/fix.php?id=78474&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78474&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78474&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78474&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78474&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78474&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78474&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78474&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78474&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78474&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78474&r=mysqlcfg

« previous php.bugs (#222478) next »