Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125043 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 qa.php.net (Postfix) with ESMTPS id ACF691A00BD for ; Sun, 18 Aug 2024 21:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724017978; bh=aFD5NRyOkTCIrYMW439xz1620oCAHKNFm2ddh9fxvvs=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=LV2jK2gECyp64PAqXOSOmeKlviIPb+XXOeex6r8FUue/exqMUtQxTvBj10QikYcQy XHs24rUcVpXiqtZV1e6gcv9tCWu+3O2GDVf2SOLzfa/lOqJiQqPaX29Jdlr49fIQAq 1bzoYXiBhwLqlGHLgaI3QX9V5LhggVdmWO5hC3CAd/g8Bw9Jt+VC7zNoKvKjrQyFT4 bNlHRBUsAdMctkKSltE7Gl7Hn0FYpo8SRi0EyZlCvFCqdjvKvz5qlEqhpRNE8C93GA zSv/hD1dKderox0bvUtORvMXCs7gNZpOGj9gAWbYwdPNgVqKgOCO1bNYw1aF1ZO4pH mqp5ereL4D2GQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BF20018003E for ; Sun, 18 Aug 2024 21:52:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout4-smtp.messagingengine.com (fout4-smtp.messagingengine.com [103.168.172.147]) (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, 18 Aug 2024 21:52:53 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id 136A6138FC72; Sun, 18 Aug 2024 17:51:05 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-03.internal (MEProxy); Sun, 18 Aug 2024 17:51:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc: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=1724017865; x= 1724104265; bh=79SGA5Cc95BS0weDXk2zia6tb8xuQf9wB9eBRNR+CIU=; b=v SYBPStfNdE3IoA2l9aiHNGf5MA67a3FLI4ggum350qTO/0x+Pg1qMYhzznrmlMfz Z3Kj3uHpsoUx7yzMTURGPiIjoEERIjur9/qNSXJA3mK4YhKyLKJellq+NM3XYzW9 WJK5YWq+ub5abzjPa8DAmkEpZUG9Uwsr+BtyK1eA9KxmqdzHcxA/+y5m8bQwjO1c JmM4P7MKDZpGfyd8MvpVFVSP2eiBRseuhMI0M4RBKFS7Ge9rhe85gHMC7QjwE9Dh 2eSF7KcGiQgbv+UKRBYenHz3quzn9WcyYiN9eJZoHTLD1hCcgW0DbQK4oUzuCeou OiEFF9hM7UqZbJXBeCI5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1724017865; x=1724104265; bh=79SGA5Cc95BS0weDXk2zia6tb8xu Qf9wB9eBRNR+CIU=; b=eLvvcZF08tOZfsELrLYnoUFvsZgpLq8nWPfZQf2NcLU+ 7K1Iyvu5VK8RZUBkdXAT3TeO3btzWO+vAImnhRaggLiLiGnq2/0XKhsSMrtzlZW5 bAvvcPwBMOcz8fwCJodO32xUxbIWo38bcEn0+2xstaGOBl49Fyy2Ag0Uod+JLKDL +5haqBFVmKqX2f6rgO5QXIBHSkjLfe19jEmACmxX9Idv2HVdEBO8J/pUFUKztmqX n3XwqGFOeTXFwLaJabCpJ0uupeH8rsEsnzdKtvhHQjTLJb+wv4dy6V1t6aHYzKjN WC33vFkwmlK3uFMeW6FzmRNdB0onaEwhP59FFb1+Ow== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddufedgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgesrgdtreerredtjeen ucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurdgtoh guvghsqeenucggtffrrghtthgvrhhnpeffgeevveegtdffgfffvdfftddvheeuleegveek teffueeliedtgeekjeettdetkeenucffohhmrghinhepphhhphdrnhgvthenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhl vggurdgtohguvghspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehphhhpqdhlihhsthhssehkohgrlhgvphhhrghnthdrtghomhdprhgtphht thhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6BBEB15A005E; Sun, 18 Aug 2024 17:51:04 -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 Date: Sun, 18 Aug 2024 23:50:43 +0200 To: "Stephen Reay" Cc: "PHP internals" Message-ID: <6cc30222-5636-48a6-be67-622954d42e86@app.fastmail.com> In-Reply-To: <44486322-F313-405C-91D0-EA13FCAD9C65@koalephant.com> References: <94259551-80EE-41F4-9CF9-679B79B5EA49@koalephant.com> <44486322-F313-405C-91D0-EA13FCAD9C65@koalephant.com> Subject: Re: [PHP-DEV] function autoloading v4 RFC Content-Type: multipart/alternative; boundary=19fcce9433be45408496ba85f6458830 From: rob@bottled.codes ("Rob Landers") --19fcce9433be45408496ba85f6458830 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, Aug 18, 2024, at 11:36, Stephen Reay wrote: >=20 > Hi Rob, >=20 >> On 18 Aug 2024, at 04:33, Rob Landers wrote: >>=20 >> I wouldn't consider it a BC break, no. But (ironically?), Symfony cra= shes with this change. >=20 >=20 > I wasn't aware of that specific code before but it's exactly the type = of issue I was talking about earlier. >=20 >> Ah, good catch. I've updated this and gone through other relevant fun= ctions. > The RFC now says "The spl_autoload function will not be updated.", but= that will *also* break if it isn't updated to at least *account for*, e= ven if it doesn't *use* the second argument given. >=20 > However I'm also curious why you would *specifically* make it *not* su= pport function loading? > The current implementation should work unmodified, once the signature = is changed to accept an int as the second parameter (and move the curren= t 2nd parameter to 3rd), There is nothing "class specific" in the exist= ing implementation except for a couple of variable names. >=20 >=20 > I would imagine you also need to update spl_autoload_unregister[1] - i= t also needs to be able to identify the type of autoloader it's operatin= g on (because the same autoloader might be defined for both types). >=20 > And lastly I think you'd need to adapt spl_autoload_functions[2] too -= perhaps the same as the others, introduce a parameter `int $type =3D SP= L_AUTOLOAD_CLASS`, so existing code works as-is, otherwise it'd be impos= sible to know how a given autoloader was registered. >=20 >=20 > 1: https://www.php.net/manual/en/function.spl-autoload-unregister.php > 2: https://www.php.net/manual/en/function.spl-autoload-functions.php >=20 >=20 > Cheers >=20 > Stephen=20 Hello again internals, The implementation has now reached a stable point and things discovered = during the implementation have been reflected in the RFC text itself. I did my best to assess the impact to Opcache, but I suspect someone muc= h more familiar with how opcache works will need to take a look. From my= understanding of the changes needed in zend_execute, it looks like ther= e are some changes needed to the JIT helpers, but there may be more chan= ges required that aren't so obvious. I've added a helper that can be use= d as a drop-in replacement for looking up functions from the function ta= ble directly, which should help. Lastly, I do plan to open a docs PR in the coming week that will probabl= y trigger some smaller updates to the RFC; mostly to smooth out the word= ing and make it more friendly for non-technical people, but the technica= l aspects shouldn't change (barring the discussion here, of course). > The RFC now says "The spl_autoload function will not be updated.", but= that will *also* break if it isn't updated to at least *account for*, e= ven if it doesn't *use* the second argument given. I've updated the text to reflect exactly that, it did require updating. = ;) > However I'm also curious why you would *specifically* make it *not* su= pport function loading? > The current implementation should work unmodified, once the signature = is changed to accept an int as the second parameter (and move the curren= t 2nd parameter to 3rd), There is nothing "class specific" in the exist= ing implementation except for a couple of variable names. I mostly decided not to support it to avoid the inevitable bikeshedding = of how a "default function autoloader" would work. I really want to push= that to a separate RFC, unless there was a general consensus of an impl= ementation. If we are fine reusing the existing default class autoloadin= g, then I am fine with that. > And lastly I think you'd need to adapt spl_autoload_functions[2] too -= perhaps the same as the others, introduce a parameter `int $type =3D SP= L_AUTOLOAD_CLASS`, so existing code works as-is, otherwise it'd be impos= sible to know how a given autoloader was registered. I've also added those functions as well. =E2=80=94 Rob --19fcce9433be45408496ba85f6458830 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sun, Aug 18,= 2024, at 11:36, Stephen Reay wrote:

Hi Rob,

On 18 Aug 2024, at 04:33, Rob Landers <rob@bottle= d.codes> wrote:

I wouldn't consider it a BC break, no. But (ironically?),= Symfony crashes with this change.


I wasn't aware of that sp= ecific code before but it's exactly the type of issue I was talking abou= t earlier.

A= h, good catch. I've updated this and gone through other relevant functio= ns.
The RFC now says "The spl_autoload = function will not be updated.", but that will *also* break if it isn't u= pdated to at least *account for*, even if it doesn't *use* the second ar= gument given.

However I'm also curious why = you would *specifically* make it *not* support function loading?
The current implementation should work unmodified, once the signa= ture is changed to accept an int as the second parameter (and move the c= urrent 2nd parameter to 3rd),  There is nothing "class specific" in= the existing implementation except for a couple of variable names.
<= /div>


I would imagine you also need to= update spl_autoload_unregister[1] - it also needs to be able to identif= y the type of autoloader it's operating on (because the same autoloader = might be defined for both types).

And lastl= y I think you'd need to adapt spl_autoload_functions[2] too - perhaps th= e same as the others, introduce a parameter `int $type =3D SPL_AUTOLOAD_= CLASS`, so existing code works as-is, otherwise it'd be impossible to kn= ow how a given autoloader was registered.

<= br>

=

Cheers

Stephen&nb= sp;

Hello again internals,
=

The implementation has now reached a stable po= int and things discovered during the implementation have been reflected = in the RFC text itself.

I did my best to as= sess the impact to Opcache, but I suspect someone much more familiar wit= h how opcache works will need to take a look. From my understanding of t= he changes needed in zend_execute, it looks like there are some changes = needed to the JIT helpers, but there may be more changes required that a= ren't so obvious. I've added a helper that can be used as a drop-in repl= acement for looking up functions from the function table directly, which= should help.

Lastly, I do plan to open a d= ocs PR in the coming week that will probably trigger some smaller update= s to the RFC; mostly to smooth out the wording and make it more friendly= for non-technical people, but the technical aspects shouldn't change (b= arring the discussion here, of course).

The= RFC now says "The spl_autoload function will not be updated.", but that= will *also* break if it isn't updated to at least *account for*, even i= f it doesn't *use* the second argument given.

I've updated the text to reflect exactly that, it did re= quire updating. ;)

However I'm also curious w= hy you would *specifically* make it *not* support function loading?
<= /div>
The current implementation should work unmodified, once the si= gnature is changed to accept an int as the second parameter (and move th= e current 2nd parameter to 3rd),  There is nothing "class specific"= in the existing implementation except for a couple of variable names.

I mostly decided not to support= it to avoid the inevitable bikeshedding of how a "default function auto= loader" would work. I really want to push that to a separate RFC, unless= there was a general consensus of an implementation. If we are fine reus= ing the existing default class autoloading, then I am fine with that.

And lastly I think you'd need to adapt spl_au= toload_functions[2] too - perhaps the same as the others, introduce a pa= rameter `int $type =3D SPL_AUTOLOAD_CLASS`, so existing code works as-is= , otherwise it'd be impossible to know how a given autoloader was regist= ered.

I've also added those fu= nctions as well.

=E2=80= =94 Rob
--19fcce9433be45408496ba85f6458830--