Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127458 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 DFBC01A00BC for ; Sun, 25 May 2025 22:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748211352; bh=XLgnroGojKoDEzKzDNdsK2YghLsfr1RveGKMla+Crgc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=isVMz+eW3ghwMrQRx3BjtFlIrGRA0GLK12+liCKYJurtNjaz24nVGbFof8U70agVK GfGQy1JjCSEwYf38Qpy4znsNOL3yh4Nd+hmS1Co+6d8yEvBW0z+pVf7oyX3p4CEM73 oHEYOsNeCr2+QLc4oYOLfg7eag5omB/O4O9z1ZaboD+XJVF0cUX1JRa+up7ISKHq0C y70hKck0+CTvAx1nJCCGySJCXxl8obHxcx+2mClzwclocYh8LmvxqhFupRXMbx4zFh xNu68avg8c2KqUw2xobsb1xYtnqhwbyz+/w8/QZrJacpkhg2ganHLnmLuaOi41DXUi 9ubD9FR2PKjgg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8AAC8180034 for ; Sun, 25 May 2025 22:15:51 +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_PASS 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 fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 ; Sun, 25 May 2025 22:15:51 +0000 (UTC) Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2913811400BE for ; Sun, 25 May 2025 18:17:58 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Sun, 25 May 2025 18:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=1748211478; x=1748297878; bh=hjQJi+OZVCFsHBQZRRGEk9RG/t0wivy2MjZuCLrlmHE=; b= kjIQLmqizgE1RYjMqRHDVTMYgiQf7axeTfY7l7XLBkGREYjx4bXunPAK1I/NMfrp wcY8J41CbACppc3wQAtnm+A631UUGEQb7clkEbI/0Gy6sMFhzjJSxQX1X3EFiyIE /jnDgVZXSo38JllncR5YV/hDYDMnBKizHcpPLVy0wml1TksaJjlMSzAr+/55+8Nh 5jxQ3JQbIVpM6hu+0Xu/+tM5DAdR034M74q5aEUY1TlH8tr1hMzTpKkWfr1prA0D 0KG/ZjlqDtLUjT2lD1VanXdhcve8QDp9kobElFN/C5WauO6G/1N77fWBUlqBwLEc YFDEi/PPCkcb8KJFE+CQ6Q== 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=1748211478; x=1748297878; bh=h jQJi+OZVCFsHBQZRRGEk9RG/t0wivy2MjZuCLrlmHE=; b=mCG/lSMaQFacjw4G6 4iQ/NYDjuGMadOYx+MTvWy9eOV659UiUYReMXuUnm4PXKYzfyY0wyFfDtUIagy5P rUJ2Mja5ciVPJCZkUKTN+3PT9WvWaa7Fw0JfPrRSinZxR1NTKEEo8yz7lVZ4UJSS 7HkXh8rM9PoXuzocwZ6/lwZNOEvAv0cquaXW9bAa7mx/OXblV5s3GBVdrDGBxPE4 93qaCLKTj/2xzEDIX0smX1eoI6bnyPxSJ+Txn/dpF6XFxN5l7gK4bze8Rl9D7pzD EnLPAfaiXZ9BJXP3qSouFWag3cz8jRXarVmSf2P7fXyingjQSJwtuIcnvRxW8U30 u+C6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdduheektdculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomhep fdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpse hrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepjeekgffhuefggfdtueehgefg udeghfdukeejhfetgeeijeelheevlefhfedvhfdunecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdr uhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhope hinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 25 May 2025 18:17:57 -0400 (EDT) Message-ID: <1c6dcd84-9016-48e1-971f-de7749cbdce8@rwec.co.uk> Date: Sun, 25 May 2025 23:17:56 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Module or Class Visibility, Season 2 Content-Language: en-GB To: internals@lists.php.net References: <9A26F72B-D0EF-414F-B193-BED3CAB26A0B@rwec.co.uk> <9f6a0d6e-27c3-4f77-aed6-e55147442b6f@app.fastmail.com> <673fd2db-b07f-439b-a4f2-e9519108d159@app.fastmail.com> <78641D8B-AF1D-4912-920A-D75A37C32F05@rwec.co.uk> <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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 25/05/2025 21:28, Larry Garfield wrote: > Even if we develop some way such that in Foo.php, loading the class \Beep\Boop\Narf pulls from /beep/boop/v1/Narf.php and loading it from Bar.php pulls the same class from /beep/boop/v2/Narf.php, and does something or other to keep the symbols separate... Narf itself is going to load \Beep\Boop\Poink at some point. So which one does it get? Or rather, there's now two Narfs. How do they know that the v1 version of Narf should get the v1 version of Poink and the v2 version should get the v2 version. The prefixing, in my mind, has nothing to do with versions. There is no "v1" and "v2" directory, there are just two completely separate "vendor" directories, with the same layout we have right now. So it goes like this: 1. Some code in wp-plugins/AlicesCalendar/vendor/Beep/Boop/Narf.php mentions a class called \Beep\Boop\Poink 2. The Container mechanism has rewritten this to \__Container\AlicesCalendar\Beep\Boop\Poink, but that isn't defined yet 3. The isolated autoloader stack (loaded from wp-plugins/AlicesCalendar/vendor/autoload.php) is asked for the original name, \Beep\Boop\Poink 4. It includes the file wp-plugins/AlicesCalendar/vendor/Beep/Boop/Poink.php which contains the defintion of \Beep\Boop\Poink 5. The Container mechanism rewrites the class to \__Container\AlicesCalendar\Beep\Boop\Poink and carries on When code in wp-plugins/BobsDocs/vendor/Beep/Boop/Narf.php mentions \Beep\Boop\Poink, the same thing happens, but with a completely separate sandbox: the rewritten class name is \__Container\BobsDocs\Beep\Boop\Poink, and the autoloader was loaded from wp-plugins/BobsDocs/vendor/autoload.php Unless explciitly specified as an "import" or "export", any reference to any class name is prefixed in the same way, and loaded with the isolated autoloader stack. To the host application, and any other plugins, the code inside the "wp-plugins/AlicesCalendar/vendor" and "wp-plugins/BobsDocs/vendor" directories is entirely hidden. -- Rowan Tommins [IMSoP]