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

From: Date: Mon, 29 Jun 2020 14:03:10 +0000
Subject: Bug #79749 [Ver->Csd]: 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-227727@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: Verified +Status: Closed Type: Bug Package: *Extensibility Functions Operating System: Ubuntu PHP Version: 8.0Git-2020-06-27 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=aca621cf926cf86fd186395d3877fc63b65f3d16 Log: Fix #79749: Converting FFI instances to bool fails Previous Comments: ------------------------------------------------------------------------ [2020-06-29 11:44:50] cmb@php.net The following pull request has been associated: Patch Name: Fix #79749: Converting FFI instances to bool fails On GitHub: https://github.com/php/php-src/pull/5776 Patch: https://github.com/php/php-src/pull/5776.patch ------------------------------------------------------------------------ [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 (#227727) next »