Bug #79749 [NEW]: Object of class FFI could not be converted to bool in a simple if

From: Date: Sat, 27 Jun 2020 20:57:17 +0000
Subject: Bug #79749 [NEW]: Object of class FFI could not be converted to bool in a simple if
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227698@lists.php.net to get a copy of this message
From: kelunik Operating system: Ubuntu PHP version: 8.0Git-2020-06-27 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Object of class FFI could not be converted to bool in a simple if Description: ------------ This works on PHP 7.4 and also works on PHP 8 with other objects like new \stdClass. Test script: --------------- <?php // create FFI object, loading libc and exporting function printf() $ffi = FFI::cdef( "int printf(const char *format, ...);", // this is regular C declaration "libc.so.6"); // call C printf() $ffi->printf("Hello %s!\n", "world"); if ($ffi) { print 'ok'; } Expected result: ---------------- Hello world! ok Actual result: -------------- Hello world! PHP Recoverable fatal error: Object of class FFI could not be converted to bool in /home/kelunik/test.php on line 8 -- Edit bug report at https://bugs.php.net/bug.php?id=79749&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79749&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79749&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79749&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79749&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79749&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79749&r=support Expected behavior: https://bugs.php.net/fix.php?id=79749&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79749&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79749&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79749&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79749&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79749&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79749&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79749&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79749&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79749&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79749&r=mysqlcfg

« previous php.bugs (#227698) next »