Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102043 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72263 invoked from network); 16 Apr 2018 23:49:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Apr 2018 23:49:49 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.50 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 74.125.83.50 mail-pg0-f50.google.com Received: from [74.125.83.50] ([74.125.83.50:38344] helo=mail-pg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/F5-36099-C9635DA5 for ; Mon, 16 Apr 2018 19:49:48 -0400 Received: by mail-pg0-f50.google.com with SMTP id b5so3456968pgv.5 for ; Mon, 16 Apr 2018 16:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=auMxEXz3QMZfaZatzpy1xwrJ1bAWzM6IAF0KSRPP33Y=; b=NAy6HQkP9AhLk633ryCj58XXZeV+v0U3ZWslavk5WqyKNjIDeegVNiOw5tz1TLFRsO a9e4/v4Bn7zDnP/CD1kmHjVZvJACj7mcm8kdArAQd5rs1EezhNpPFvxWsknI+c9DPykc 35+5WSBpoxTczCchMyZj66XGIE37TeFri6EQBry6kvsgOsJ9sVXXJPtKm9jkAuhkPMQt TFKE5nhn/vI50J3kTpiICLqUAqKh1v3X65GYDB6W2JwTcusNzHfDpNcPuTc0t/jtiLNp EDq4mK2q3+iTGReTnd/+7j7wzqws+n2TkNPk8F9zRdwMNz6SggWRsD9WzSys3gZvU0fu G31Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=auMxEXz3QMZfaZatzpy1xwrJ1bAWzM6IAF0KSRPP33Y=; b=b+s6g1hl+iJqHOwoZreFkg2vTapKSURKp2wxCNGetneSTfx+f91ds5ublTR5vBCJM+ VM1Wp/Jr+f8a2D48oqPyxCSqCjuONSCzDKchlxFNsBgeeVs4RR/ECFncdZ8cr/bSjPnY ko7j05h5EctR6NgL+9eco3TPmyfEAG3IQlGtgxwmdQW/gzXlZoYJ79RrP60Sn8JLcErG VNqk9WmIOF6YrJr3COo0Q2Sz/rb+ITyVj7bfnRdHUZveG17xIcZbtfCfvS8phmzfIJCW fXAwwoqVeNXRmcFkruFrEYTmjfQsVAHO4+pWMFSdBdeCrDRBfJpu7a1qAdy7dWUHFXPM /P4g== X-Gm-Message-State: ALQs6tCn2BH8fLzOlWMg/WJiqjOQyRVu9hGV2bmMuzOo8xMb4z4ODOYn ILKq5ngiwvmop0Pyi7tJXUDO+6s= X-Google-Smtp-Source: AIpwx4++GJHeeRMAzjlHwu6jXoyNVQwUydO0xYMHW7c0BmygLTzwITSqwrjcGVIza1LYIlA3gPlfeg== X-Received: by 10.98.76.196 with SMTP id e65mr23546696pfj.35.1523922583931; Mon, 16 Apr 2018 16:49:43 -0700 (PDT) Received: from Stas-Pro-2021.local (24-104-73-24-ip-static.hfc.comcastbusiness.net. [24.104.73.24]) by smtp.gmail.com with ESMTPSA id 75sm26474596pfx.71.2018.04.16.16.49.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 16:49:43 -0700 (PDT) To: Dmitry Stogov , Zeev Suraski , Xinchen Hui , Nikita Popov , Bob Weinand , "Anatol Belski (ab@php.net)" Cc: PHP internals list References: Openpgp: preference=signencrypt Message-ID: <56794c33-a728-d399-2462-b62ba1b7a509@gmail.com> Date: Mon, 16 Apr 2018 16:49:34 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP FFI extenesion From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > I've spent some time thinking about simple FFI for PHP, and finally, borrowed most ideas from LuaJIT. > > This is an initial PoC. It was tested on Linux only. > > > https://github.com/dstogov/php-ffi > > > I would appreciate review, comments and ideas about missing features and functionality. > Looks interesting. On a cursory look, couple of thoughts: - I think all the classes involved should be made non-serializable and non-unserializable. - Does it load shared libraries, or only uses ones already loaded? If the former, I think there should be a way to unload them at the request end (even though it might be performance issue, and may be not possible if persistent resources are involved), otherwise we leak state between requests. - OTOH, people may want to load a set of persistent definitions from a config file, etc. - the ffi definition probably won't change much, and having locked down set of FFI interfaces the rest of the code is using might be beneficial - Since this thing is dealing with raw pointers, etc., from PHP code, there may be a lot of crashes from using this extension in a wrong way. I wonder which facilities we could provide for helping people to debug it (for people who aren't super-comfortable using gdb on PHP engine). -- Stas Malyshev smalyshev@gmail.com