Bug #77708 [Fbk->NoF]: FFI Segfaults when using Closure::fromCallable

From: Date: Sun, 24 Mar 2019 04:22:05 +0000
Subject: Bug #77708 [Fbk->NoF]: FFI Segfaults when using Closure::fromCallable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220158@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77708&edit=1 ID: 77708 Updated by: php-bugs@lists.php.net Reported by: ircmaxell@php.net Summary: FFI Segfaults when using Closure::fromCallable -Status: Feedback +Status: No Feedback Type: Bug Package: Unknown/Other Function Operating System: linux PHP Version: Next Minor Version Assigned To: dmitry Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2019-03-11 12:46:05] dmitry@php.net The crash is fixed. However, Closure::fromCallable() can not create closure for FFI function and throws exception instead. ------------------------------------------------------------------------ [2019-03-07 14:43:03] ircmaxell@php.net Description: ------------ When attempting to create a closure from an FFI function, it results in a segfault when trying to call the closure. Test script: --------------- <?php $header = ' int printf(const char*, ...); '; $ffi = FFI::cdef($header, 'libc.so.6'); $cb = Closure::fromCallable([$ffi, 'printf']); $cb("Hello World\n"); Expected result: ---------------- Hello World Actual result: -------------- Program received signal SIGSEGV, Segmentation fault. 0x0000555555ae0c0d in zend_closure_call_magic (execute_data=0x7ffff3a13180, return_value=0x7ffff3a13100) at /.../Zend/zend_closures.c:249 249 EX(func)->internal_function.scope->__callstatic : EX(func)->internal_function.scope->__call; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77708&edit=1

« previous php.bugs (#220158) next »