Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127536 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 2D0E41A00BC for ; Mon, 2 Jun 2025 16:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748883351; bh=zN8NK8EzR2kz7XxQkcz4NjoWddjyR9H0fO+Z2zYAuZg=; h=Date:From:To:In-Reply-To:References:Subject:From; b=YeXZQQqLnCC6MGiUN5Vg8X+P/HoMzOn2ZKVF3hjcz1NQQEG3Jl8YQwEKGVjrKea8p y3r3uE/V+lVtMHxUStLimaUapRaVtap8xaGRT4MrI3muRrRwRhLfI49j4dmbhfC3Rk MkW3TVoNLFzOklzmLxV0dysjAtoRG1WVkRMWlL9nLe8SWP7I5Z0p0OtEKAGKHRoGuc pJzjthOUKxiDInTHasr1nmuA6MLsa6bNx6ts6VNpfQJ4kWwg7xX0iy13YcZhOkxAAo 4gWGNro/3+k68r/lPL+acYtUPADzUCNtzP6MHjTFgODMWQ+FPhRORPz1siOWq/3WqC rhYvO7JzUqTRQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9729E180086 for ; Mon, 2 Jun 2025 16:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 2 Jun 2025 16:55:50 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 6A04F1380321 for ; Mon, 2 Jun 2025 12:57:54 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Mon, 02 Jun 2025 12:57:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1748883474; x=1748969874; bh=n901BFbm6Gyox5Vw52PvS fcedBd5km17kFirDJo6C0s=; b=WIyr51bYLxW4u5x+CyTP5hR4XAxYBCR5Fm3M8 B8+OQ96MQcsihZdzBIiryGoHMRZ/LUCmMQtVAwEZn5Jy3RncfvTxJdTPUnu1itea iCgVsLJttGdDm8qMOTEvX81BG1mBwbWKS3BQzSgrTbrH6dreLOv6BULs3ZPmXeJD U3aNov3mXyrsuoNO2vY9MQpkJdgngjZwA2qWS+/ilkl4BgPjg54ZxVlfNnbD15eZ bSTDnjMT8h9appTZ4MPIXhoiFvqItgNHsa96+mbYA9LQQRX0Pco2z0zuGOMeHLWm KBxzmVgoc0T1Wtqz3MZvwLsL6XimeoXoU7fczEFo0HAOEEDvw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1748883474; x=1748969874; bh=n 901BFbm6Gyox5Vw52PvSfcedBd5km17kFirDJo6C0s=; b=kJmc6LPFSRKGHHgzD j1TeUOa3XqWNIGSb9RIQ04kgQaX5s9QZSqFv4cc7sHLKCmCyFF0sWQxXgTwB6LSB 1A2pEhvi6OS2n5TFHBpw18PKejkTRUHBcnls0NXLdBeamVeBFHH3LDWVXmM1NCjk grdcOZqESEXar57R5RkeG+dpUWbE3Q0afeu32hgsT/p3uNthCWytRYpm/14Vsm8Y tQeGV/qNiSknP9uWtYL15m8rweqxVGcXNZ9yhtQmV8F5/s5kfmXRtdq9MGsHDB6n AzPtk9YVYX5m4PjuAOroL+yhD4wH0h1Ceiy18tDpsSfBAr4wtewcPB+0cHAtGvlZ kHmTw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdefkedvudculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgj fhfutgfgsehtjeertdertddtnecuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufd cuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghr nhepudegvdelgfeugeehfeejteffudevleethfefgeejffffleegtddtveekgeekudfgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhr hiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvg epshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhp rdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 0BB96700060; Mon, 2 Jun 2025 12:57:54 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Te4ea9ce7af33d8fb Date: Mon, 02 Jun 2025 11:57:33 -0500 To: "php internals" Message-ID: <5eb5b1b4-7cb2-4a2b-afdd-ad3e83ae856d@app.fastmail.com> In-Reply-To: <894DC5D3-3CDD-479F-BAC1-70EE1AE0C5E2@rwec.co.uk> References: <354cb888-97c4-4f8c-a0da-359d1e63c0f9@rwec.co.uk> <10D95B6E-094B-4EAE-A18A-AF6B795CB352@rwec.co.uk> <2adbff61-5e11-4d39-ab5c-d7950a4550a6@app.fastmail.com> <79E7FA26-2F5A-470C-B1DF-12CC46A08FE5@rwec.co.uk> <1c6dcd84-9016-48e1-971f-de7749cbdce8@rwec.co.uk> <44F59416-3922-4AF4-881A-C64F2C4E9345@rwec.co.uk> <7F11844A-A98C-4843-BC94-815FBCD2B73F@garsi.de> <7840468C-F60C-4A44-AE40-16F9007EF428@rwec.co.uk> <160E9B1D-9AF6-479B-A628-A73C618D7C1B@garsi.de> <2c5c241c-bd05-4200-b6ee-e94c8ab0db1b@rwec.co.uk> <894DC5D3-3CDD-479F-BAC1-70EE1AE0C5E2@rwec.co.uk> Subject: Re: [PHP-DEV] Module or Class Visibility, Season 2 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Mon, Jun 2, 2025, at 9:44 AM, Rowan Tommins [IMSoP] wrote: > On 2 June 2025 14:27:45 BST, Larry Garfield wrote: >>Were we to do that, then the consumer container-loading needs to take any potential module-definition into account. Eg, if one class from a module is pulled into a container, all of them must be. > > You wouldn't containerize "something from a library", any more than you > containerize "part of Nginx". You create a container, and put a bunch > of stuff in it *that doesn't know it's running in a container*. A Linux > container doesn't know that Nginx requires a bunch of shared libraries > and daemons, it just creates a file system and a process tree, and lets > you do what you like with them. > > Let's say I'm writing a WordPress plugin. It's just a bunch of files on > disk, some of which I've written, some of which I've obtained from open > source projects. Maybe there's a giant file with lots of classes in, a > vendor directory I've generated using Composer, some Phar files, and > some fancy modules with metadata files. Maybe I distribute an install > script that fetches updated versions of all those things; maybe I just > stick the whole thing in a tar file and host it on my website. > > I want to have WordPress load all that code as part of my plugin, and > not complain that somewhere in there I've called a class > Monolog\Logger, and that name is already used. > > I don't need WordPress, or PHP, to know whether that class is "really" > a version of Monolog, or how it ended up in the folder. And I don't > need twenty different containers for all the different things in the > folder. I just need to put *that whole folder* into a single container, > to separate it from someone else's plugin. > > The container somehow creates a new namespace root, like a Linux > container creates a new file system root. The code inside uses require, > autoloading, module definitions, etc etc, but can't escape the > container. > > Then in some way, I define what's allowed to cross the boundary between > the main application and this container - e.g. what parts of the > WordPress API need to be visible inside the container, and what parts > of the container need to be called back from WordPress. > > And that, if it's possible at all, is the plugin use case sorted. No > changes to Composer, no need to rewrite every single PHP package ever > written. Probably some caveats where dynamic code can accidentally > escape the container. Completely separate from the kind of "module" you > and Arnaud were experimenting with. Well, now you're talking about something with a totally separate compile step, which is not what Michael seemed to be describing at all. But it seems like that would be necessary. At which point, we're basically talking about "load this Phar file into a custom internalized namespace", which, from my limited knowledge of Phar, seems like the most logical way to do it. That also sidesteps all the loading and linking shenanigans. Doing it that way, as a Phar-loading-wrapper, is probably the most likely to actually be viable. I'm still not sure I'd support it, but that seems the only viable option so far proposed. --Larry Garfield