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

From: Date: Mon, 29 Jun 2020 11:41:52 +0000
Subject: Bug #79749 [Opn->Ver]: Object of class FFI could not be converted to bool in a simple if
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227722@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79749&edit=1 ID: 79749 Updated by: cmb@php.net Reported by: kelunik@php.net Summary: Object of class FFI could not be converted to bool in a simple if -Status: Open +Status: Verified Type: Bug -Package: Scripting Engine problem +Package: *Extensibility Functions Operating System: Ubuntu PHP Version: 8.0Git-2020-06-27 (Git) Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2020-06-27 20:57:17] kelunik@php.net 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 this bug report at https://bugs.php.net/bug.php?id=79749&edit=1

« previous php.bugs (#227722) next »