Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80322 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56649 invoked from network); 10 Jan 2015 12:12:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jan 2015 12:12:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.175 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.217.175 mail-lb0-f175.google.com Received: from [209.85.217.175] ([209.85.217.175:46872] helo=mail-lb0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/F0-48183-14711B45 for ; Sat, 10 Jan 2015 07:12:49 -0500 Received: by mail-lb0-f175.google.com with SMTP id z11so11891626lbi.6 for ; Sat, 10 Jan 2015 04:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=muywjp4rBs3Z6J5vPWWQAXdFsrjyD/zzBFMfFBMfjGQ=; b=k376adBeQ/Ucgk7Uempgg4WH6eQ/XCDfpVLSPU54StDzBdjlNS7lviFsMigZYiMCWY YccMVaR2QoCkgR9ruNqjgpUk2hnq8KKC1GbXSyJQWRRXm97m7Z488qBrxTAM4T8Uq2jw YvcaUN5ewbTLCkeFHa9td4O0iv8E4Q6VUUYDBoTtnSXn8GxphXO+oF89wFVxN+5GbyfF 0pAkVSu1UdukraM7RZWGDENh+RtRuzzThaHnRBUCgOsj8xJm6XHnd0I9GySPgMel5LHE RqwoB4seqkwzRdUnUo0Nq1RU3nOl48QOygtr445M8MpFmUMgseMybN8/kCyc718uIQhe 3FLg== MIME-Version: 1.0 X-Received: by 10.152.18.135 with SMTP id w7mr26033950lad.47.1420891965726; Sat, 10 Jan 2015 04:12:45 -0800 (PST) Received: by 10.112.154.133 with HTTP; Sat, 10 Jan 2015 04:12:45 -0800 (PST) Received: by 10.112.154.133 with HTTP; Sat, 10 Jan 2015 04:12:45 -0800 (PST) In-Reply-To: <001501d02ccc$574a6bf0$05df43d0$@tekwire.net> References: <001501d02ccc$574a6bf0$05df43d0$@tekwire.net> Date: Sat, 10 Jan 2015 04:12:45 -0800 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: PHP internals , Benjamin Eberlei Content-Type: multipart/alternative; boundary=089e0141a7dae1a3a1050c4b30dc Subject: RE: [PHP-DEV] [RFC] Extension Prepend Files From: pierre.php@gmail.com (Pierre Joye) --089e0141a7dae1a3a1050c4b30dc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Jan 10, 2015 6:55 PM, "Fran=C3=A7ois Laupretre" w= rote: > > > De : Pierre Joye [mailto:pierre.php@gmail.com] > > > > A proof of concept, IRC log, I am lazy :) > > > > benjamin, Derick > > https://gist.github.com/pierrejoye/ce4867a5eaabffa71df4 > > https://gist.github.com/pierrejoye/0859e3702ceb3bb652b6 > > https://gist.github.com/pierrejoye/544e60d8994094c55583 > > too slow internet for a fork & PR > > but it works now. Add PHP_BUILTIN_SCRIPT(date, > > PHP_EXT_DIR(date)/date.php) to config.m4, and call manually > > zend_execute_script in RINIT, could be easier to do it in a register > > function, inside MINIT and let the engine do it on RINIT, actually > > cleaner, but this patch is only a prrof of concept to play with > > Thanks for this. I thought you were opposed to bundling PHP code in extension... :) Does not mean I cannot help to have a base to discuss. > I prefer the solution where the extension execute the script(s) in RINIT or at any time, instead of registering scripts in the core and let the core trigger script execution. The main reason is that executing EVERY scripts in RINIT is just one use case among many others. It will remain in RINIT, it simply could be calls e by the engine automatically. That would allow running order too. > The problem I see with zend_execute_string() is the relationship with opcode caches, because the filename you provide is not a real filename. When an opcode cache receives such a name, it will analyze it as a valid plain file name and it will try to stat() it for mtime, which will probably fail... Actually, the opcode cache has no way to understand what's going on here. That's why I proposed to use a stream-wrapper. It would imply a registration mechanism to ensure path unicity but it would allow opcode caching. And opcode caching is most important here, especially for code executed systematically at RINIT time. Opcache is why I think we should have a list registered names. A simple hash exists and the cache will know what to do. > Cheers > > Fran=C3=A7ois > > --089e0141a7dae1a3a1050c4b30dc--