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

From: Date: Mon, 23 Sep 2019 13:22:19 +0000
Subject: Bug #78543 [Csd]: 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-222892@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
 User updated by:    asmqb7 at gmail dot com
 Reported by:        asmqb7 at gmail dot com
 Summary:            is_callable() on FFI\CData -> Exception: Attempt to
                     call non C function pointer
 Status:             Closed
 Type:               Bug
 Package:            *Extensibility Functions
 Operating System:   Linux
 PHP Version:        7.4.0RC1
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Awesome, thanks!

(And the patch is... yep, totally over my head :) very grateful for the fix)


Previous Comments:
------------------------------------------------------------------------
[2019-09-19 07:18:22] cmb@php.net

Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9dfbcd7248012ac651a48eb871bfa58bb9e6c5d7
Log: Fix #78543: is_callable() on FFI\CData throws Exception

------------------------------------------------------------------------
[2019-09-18 09:59:57] cmb@php.net

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

------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#222892) next »