Bug #78543 [PATCH]: is_callable() on FFI\CData -> Exception: Attempt to call non C function pointer

From: Date: Wed, 18 Sep 2019 09:59:57 +0000
Subject: Bug #78543 [PATCH]: is_callable() on FFI\CData -> Exception: Attempt to call non C function pointer
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222805@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78543&edit=1 ID: 78543 Patch added by: cmb@php.net Reported by: asmqb7 at gmail dot com Summary: is_callable() on FFI\CData -> Exception: Attempt to call non C function pointer Status: Open Type: Bug Package: *Extensibility Functions Operating System: Linux PHP Version: 7.4.0RC1 Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix #78543: is_callable() on FFI\CData throws Exception On GitHub: https://github.com/php/php-src/pull/4718 Patch: https://github.com/php/php-src/pull/4718.patch Previous Comments: ------------------------------------------------------------------------ [2019-09-15 12:26:57] asmqb7 at gmail dot com Semantic clarification: I'm using PHP7.4.0beta1, not 7.4.0RC1. ------------------------------------------------------------------------ [2019-09-15 12:25:13] asmqb7 at gmail dot com Description: ------------ Unsure what's happening, so not going to make myself look silly with wild and probably incorrect guesses. (Something something FFI\CData not being able to tell the difference between "are you callable" and actually being called... I'll be curious to read the patch.) Just started playing with FFI, which is very fun. I look forward to the crazy and awesome things this is going to make possible. Thanks so much :) Stumbled on this because my d() routine (generic-everything dumper) crashed in its type detector function. (NB. The testcase below drops is_callable()'s return value, since it makes no difference.) Test script: --------------- <?php $ffi = FFI::cdef(' struct test { int dummy; }; '); $test = $ffi->new('struct test'); is_callable($test); Expected result: ---------------- For is_callable() to return false Actual result: -------------- Fatal error: Uncaught FFI\Exception: Attempt to call non C function pointer in ... Stack trace: #0 ...: is_callable(Object(FFI\CData:struct test)) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78543&edit=1

« previous php.bugs (#222805) next »