Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80284 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82248 invoked from network); 8 Jan 2015 18:46:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2015 18:46:51 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.173 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.173 mail-ie0-f173.google.com Received: from [209.85.223.173] ([209.85.223.173:51621] helo=mail-ie0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/E9-21915-990DEA45 for ; Thu, 08 Jan 2015 13:46:50 -0500 Received: by mail-ie0-f173.google.com with SMTP id y20so11031342ier.4 for ; Thu, 08 Jan 2015 10:46:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=hChYf6rG01xPHQnUbwOQn6aH4+7eu2Ab7tZDe4T4wKM=; b=L0SB2iH0FLXFsv0wv0RJh3EmpLscLBxKR6uHK8GVUgz6RxFldv/yunCajADjBoQ5F3 a3UOqJ56fIxnDrxw1LU1Jo7roGHQtjqtZpt0bW5nLB/OCuiZJRUBHLEkSmMx89YMiyvW HA0ec/R/wGw2lIlPpWcM6ljki9pCc50FE/dtY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=hChYf6rG01xPHQnUbwOQn6aH4+7eu2Ab7tZDe4T4wKM=; b=drSdSX2VyjsunMBby2Ooh2amc/WJJMRgbLluf0xaYm7gouYrd5nCKRj7JEW2cQDfJU CCHQ/nIen9GYa8Fnwv0LViMj/A9MMMPJvCxfJlcbLSrs0FdNBwnJVc3jYNuvt+PzDfpm 1TfppSirscth/OeuUe/L4+ykRT0SYZyD3E4BaoaqaTAy07ongQ/LDlK5t+5XoS6nzDFO POxJmISpQDcMzLTLYBbDbG5WpN94P+FnOJmDT3gAQUdYW3eZNC4JcbrZHhz9vIlAx+DN R+yhnF6BgefRWO+Zd2xfaz7bD1qKXk+dfzY94ks4irnoPTgjSuPjq56A3SfvrJR+J6hV q+gw== X-Gm-Message-State: ALoCoQmdCZam2FUf+N+2jw1ueQ1pwQXxnK/bofwzOStmoaWc9m6XOz4/UwM/mcDK/6PA7q3sJf1b X-Received: by 10.107.138.5 with SMTP id m5mr10696758iod.85.1420742805989; Thu, 08 Jan 2015 10:46:45 -0800 (PST) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.43.112.9 with HTTP; Thu, 8 Jan 2015 10:46:24 -0800 (PST) In-Reply-To: References: <54AE7340.6080708@fedoraproject.org> Date: Thu, 8 Jan 2015 10:46:24 -0800 X-Google-Sender-Auth: HOPosyA2lTax43DRBwipMnSN0A8 Message-ID: To: Benjamin Eberlei Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Extension Prepend Files From: aharvey@php.net (Adam Harvey) I'm going to be a bit hazier than normal in this e-mail, for which I apologise. People who know who I work for, you can probably guess the parameters of the NDA I'm trying not to break here. On 8 January 2015 at 04:38, Benjamin Eberlei wrote: <+1 on everything I snipped> > Examples of good use-cases for this feature: > > 1. Low-Level MongoDB connection code in C, userland OOP API in PHP. > 2. Low-Level Crypto code, simplified PHP functions (think ext/hash + > ext/password) > 3. Database Vendor Extensions in C + common DB abstraction in PHP (PDO2). > 4. Low-Level Date handling, high level PHP code Let me toss another use case onto the fire. Imagine you have an extension that replaces the zend_execute_ex pointer so it can fire hooks before and after a particular function is called. You can write those hooks in C, but there's no actual reason they need to be =E2=80=94 they're not performance-critical, and don't requi= re access to any internal APIs. At that point, it would be nice to have a mechanism for shipping PHP code with your C extension that doesn't require any external dependencies. As Derick says, "pecl install foo", not "pecl install foo && composer require foo/bar && some sort of startup code in userland". This code isn't optional: it's required for your extension to behave properly. It's intimately tied to the exact extension you're shipping =E2=80=94 you don't want to expose a stable API to userland for this, becau= se there's no need, and it's irrelevant for users anyway. Why not allow a way for extension authors to ship this code as (hopefully) safe, managed PHP instead of C, in a way that isn't reliant on tooling and could allow version drift between the C and PHP code bases? This isn't a new idea. We've talked on IRC about shipping bits of the standard library as PHP code instead of C for years. Having this mechanism =E2=80=94 whatever form it ends up taking =E2=80=94 would help th= ere. > I should rewrite the RFC and remove the implementation details, because > essentially the solution could also be tooling based (vs code based). It could, but I think there's a benefit in having a non-tooling based way to do it. Much as I (genuinely) wish everything was open source and could be installed through PECL, there are plenty of closed source extensions for PHP. Adam