|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78543 is_callable() on FFI\CData -> Exception: Attempt to call non C function pointer
Submitted: 2019-09-15 12:25 UTC Modified: 2019-09-23 13:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: asmqb7 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: *Extensibility Functions
PHP Version: 7.4.0RC1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: asmqb7 at gmail dot com
New email:
PHP Version: OS:


 [2019-09-15 12:25 UTC] asmqb7 at gmail dot com
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:

$ffi = FFI::cdef(' struct test { int dummy; }; ');

$test = $ffi->new('struct 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))


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-15 12:26 UTC] asmqb7 at gmail dot com
Semantic clarification: I'm using PHP7.4.0beta1, not 7.4.0RC1.
 [2019-09-18 09:59 UTC]
The following pull request has been associated:

Patch Name: Fix #78543: is_callable() on FFI\CData throws Exception
On GitHub:
 [2019-09-19 07:18 UTC]
Automatic comment on behalf of
Log: Fix #78543: is_callable() on FFI\CData throws Exception
 [2019-09-19 07:18 UTC]
-Status: Open +Status: Closed
 [2019-09-19 07:21 UTC]
-Assigned To: +Assigned To: cmb
 [2019-09-23 13:22 UTC] asmqb7 at gmail dot com
Awesome, thanks!

(And the patch is... yep, totally over my head :) very grateful for the fix)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 13:01:29 2024 UTC