Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128305 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 6C7A71A00BC for ; Tue, 29 Jul 2025 18:21:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753813182; bh=ObQiBNI8qoTYWL6oETA4do+0rU+zO9R3Ahpwdelde/w=; h=Date:From:To:In-Reply-To:References:Subject:From; b=LJ+luU8CxdPB4u9foX/bHJ9dEPyT4+zfvDse7OptEwdz+mIO5yYcQ0leektwSdfqy F5slKeRdqxWtzhwAFXVn43S+UKceFQDxLu/YrjTxAJKSGASmOBiSzA4/HeIwvrWWn2 AZ7Ztx9T3Zi6+BqM0n3EEUbgaEQwruY8A6nTlXGlQlkrFBySEhqyQ9fkm3/D0mQi8d f75jT4D85mNvhbFvcYWFZfxPE/hQEn5EhIYMK1rAr8zGN8hTDXjCqkinD0LdbEDCy2 JSqhCd0o2nSpqAC5qL6QyIn8Gh8eh0C+k39HcFO8xy05DTpYRd2cZe5VVbp5Rgef+h BTqaEezw/0pMg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B76E8180087 for ; Tue, 29 Jul 2025 18:19:41 +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=-0.3 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_FONT_LOW_CONTRAST,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,URI_HEX 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 mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Jul 2025 18:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thomasbley.de; s=s1-ionos; t=1753813282; x=1754418082; i=mails@thomasbley.de; bh=WC1pE+Py2ADe6RHfQZxqZRIJ8BLPH6mwAZaKI6CO9Kc=; h=X-UI-Sender-Class:Date:From:To:Message-ID:In-Reply-To:References: Subject:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=fLJYJ5xltp5CWawZ2pTJYuLdIDJzjcHeahtRSyZUZWslKwWT8g+qpxxg3comf0mM Gosrdvne/+a1NnT0q+bkEtdoP6+Hk//Ae+rMkbqoEqHqBZ96dd3aMz3NfEbwq8lPh CmC7fl7B/+ke/yPNwFz0gmGw0gtHNQ+lrYSUbLPHt70tFwUmwoihL+o+tWun4uJ13 GU2wPTNHqgkjwAgYGBUgf5K0BZP23isFAVJ8pa1B0m7fuhiF3kJRmCefI1Ywgsw4Q 9wwzAchgzzzk+Jhb8fn0hEp5F/xSahQqpO4jVi91vgvbe/t06/92SXpasimzKRmvO 7+SpWueo6F/rNCemiA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from open-xchange-core-mw-default-5.open-xchange-core-mw-hazelcast-headless.open-xchange.svc.cluster.local ([10.73.157.99]) by mrelayeu.kundenserver.de (mreue012 [172.19.35.3]) with ESMTPSA (Nemesis) id 1M8C8J-1ulTmr1PVr-000EyJ; Tue, 29 Jul 2025 20:21:22 +0200 Date: Tue, 29 Jul 2025 20:21:22 +0200 (CEST) To: Gregory Magarshak , internals@lists.php.net Message-ID: <1744099889.304344.1753813282179@email.ionos.de> In-Reply-To: References: Subject: Re: [PHP-DEV] Three proposals for PHP 9 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_304342_979957016.1753813282174" X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v8.36.54 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K1:rJE24tjk0b2sp6zZsL7wkO+QBC28gmEuLJaHHbzHoRv0tYCBFL9 aETefg22gYFHJs9bZzWVseirA1M6169rjkpdIzOEUQQh/VcHWbAjIwNgn1JqZ2/vUCXs/Yi PE3tNSuAWUwse3HT8SXRr0i1aESfEe1rbFgU1SHG50qNwMHvwOxTCGvnJBtPHRlfD8y3wTK sXjS551PWTK942hmjt4Bw== UI-OutboundReport: notjunk:1;M01:P0:+9OWWGWNtnc=;Bd9ldKHS/buS7YqkNKp/WJRUfUi zYs7ASF/gyR0+Mo/BwEPYkD5WCPW6r25xkDxsVZCJlB7nEGPZfJ4S+ryskp3wvwl0tmv5gkre npPhw+Rvvan/UeYrUoaaXcMSzILCGsRTj8n6VuQy/z/PN3CqZfeUWDOf4GpAFEyrzu9kAyQ2n W0tfqRyd6yt6ATgonA3vGFD16eqY8/OjUAH3wPRl0+eFcGIOC4wz6aLOPUhJWLpC45c9kX2PK owXA/nFkS1sIXszxf+9rsfrP5FqKc4oJyey1UT835paPYymznUkJROXiEdg2urvjj2DOF5z78 RzldZSGuyk6vBimXkY/HuBGDnT033aUacMh+9ydFKrXeZZBMvccRJlSxzhbzdIuJtnMMEsjCg l/FONXHDjNCUp6hAsKVPOw5ZoyJL5MxElQCuafbXMNwABJ/SE08xZJFiGEL/AAQrw88/KWE+m eX7de0lbEl/kTRdBkTGCHQmHXasVPwYFgn68yMZtsRLpINg07O0MzlXfvPbhrD2lfpmfOcm7b weVaR9yAbQXLUxYYVWEPO78Rke3c6+XPQtsZ246u8XkkxQ8PiwKJsFX0v+kvR0VCnRXPGMO/H PGTeijBPyaA6zTey1PNR/zRKkYBdSNo8L2K4WsMDRXkPMhigScxsNKQcQ8Epd+/6M3goGDMSF 181uZvUUgG8b6X/3YdCxG/47TSQmnqR+sZa5mw2jpd4I61IbV+LMd7JwwPi9yExWdeuwRsGiq RhPHSO+/hKS+WjYSnopgkxyhPV115+W4xWa+e+b1zSDNlBpfDDg7YBLP7MpOZTUL8yMU6Owbb 6kn7i3S7NLgW4xQXQ9fspiAOemrtcsoSVqo43oGnWs9vtmIwBiu35X9CLTSpEsq4TzVJeEsyt ee5dA+jZvXkpKCCRMAlUDw61GFTk9YX3pN3cckyrVm7g1QG1LiMWhVCnQs9XjnIJS6C+Nthou CDzy2pYGbyDExOl4w0MHguVWA0ReAlrFqLwghn/1k4KbTdn2eIOaPCRwIwx6+N+DNlR2rXy9J T+/fA3OqsdQl8aUHNgD2kFElm5nuMC2K184R3JCMLnVWuBVOmWpj9AUhz7G/NWmL9BtFrunD4 R9FgDCssG9z1wY20wN2OdAa1BWaaJFWDh+wZwdVJ+h4HL4Q+f5f2S5d3AC1rKnUM8Ql55Ts12 hip26h5ed4WemosmS3qcvLKKA4N6OFYIiUYJEKCC4ujCKhkHBEDMtVcLXlkt47TfIiJ1Vyb9t LalaXg+OSgvAqdgQCs838Giesi85xYGxANPYM6WpMEkg+Hvlz+UWHU0cn9etJab2PozEISVod 5sq20PPpxBO1zNJsTX07F5SE3lYMslzK7QjE8vBiB0ozx87c5JRXzHZDx+GOAauyECgSqhQyH 1TC7U0XsUlE77jsNfocbL8r+pM/N/cOVs5ysTiXyTPWrdOcLV2f07002fc4ny4GRT99WPXrOf YWwhCRC/+VyMcvk9fhM9cp00J4AKbwT+owVQnnz3eLsFclF8hQfo19+6MZDt3QflVhvH5qA== From: mails@thomasbley.de (Thomas Bley) ------=_Part_304342_979957016.1753813282174 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20 > Gregory Magarshak hat am 29.07.2025 19:46 CEST geschriebe= n: > =20 > =20 > I came across this post on Reddit asking what people would like to see in= the next PHP: https://www.reddit.com/r/PHP/s/l9r8UJP6Rk > =20 > There are two major proposals I would make, both of which aim to greatly= improve PHP's competitiveness and ecosystem, while maintaining its spirit = and what makes it great. And one minor proposal. I wrote them on Reddit, bu= t then I realized I should actually do something about it. The last time I = did something was in 2015 writing to the PHP list back then. > =20 > How do I get rights to create my own RFCs for these? I tried to do it on = the web, but it says to ask on the mailing list. Here are my bona fides: I'= ve spent about 20 years with PHP, to be honest, and the last 14 building an= open-source community platform / CMS that competes with Facebook, Twitter,= etc. and uses very idiomatic PHP. Here are two links in case anyone is int= erested > https://github.com/Qbix > https://www.laweekly.com/restoring-healthy-communities/ > =20 > Anyway without further ado, I would like to present the two proposals: > =20 > First one: introduce switch_global_context($name) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =20 > I really love PHP=E2=80=99s shared-nothing architecture, but when it come= s to frankenphp, swoole etc. it is very hard to port existing apps to that = evented runtime. That is mainly because the superglobals and static variabl= es are =E2=80=94 well =E2=80=94 global. You can have the best of both world= s. > =20 > Just add a function to PHP which can do context switching between all glo= bal scopes, to any named scope. So when you have one evented runtime, it ca= n quickly switch. This should be easy to do with SHM (shared memory segment= s) and just pointing to a different page in memory.=20 > =20 > The goal is to allow all =E2=80=9Clegacy=E2=80=9D code (ie all current PH= P code that runs on php-fpm etc) to be trivially ported to much faster runt= imes, while remaining =E2=80=9Cshared-nothing=E2=80=9D for all intents and = purposes (global contexts would be isolated from one another because only o= ne could be active at a time). > =20 > Second one: set_encryption_seed($name) > =20 > You might need to let people register functions to run before a context i= s saved (sleep) and after it is loaded (wakeup), when there is memory press= ure, PHP can handle this in a standard way and even encrypt it at rest. You= can also do this for session save/open handlers (which you already do). > =20 > Just have an environment variable or function like set_encryption_seed($s= eed) at startup of frankenphp or swoole. > =20 > Third one one: Improve func_get_args to return associative arrays. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =20 > I had this suggestion back in 2015 but maybe now it=E2=80=99s outdated. Y= ou see, functions typically start out having required arguments first, then= add on optional arguments later. I thought based on how PHP passes argumen= ts, it would have been trivial to enhance func_get_args to return an array = indexed not just by numeric values but also string values! > =20 > And therefore one could pass arguments like in python: func(2, 5, $foo = =3D> $bar, $baz =3D> $choo) It also would look exactly like the familiar ar= ray composition syntax. But this is no mere syntactic sugar. It helps devel= opers fall into the pit of success by creating backward-compatible interfac= es and making any function extensible, improving the entire ecosystem. > =20 > Sincerely, > Greg Magarshak > https://76183cf5.streaklinks.com/ChUGGA0vb2UyLmRu_AoCdl6f/http%3A%2F%2Fqb= ix.com%2Finvest > =20 > =E1=90=A7 > =E1=90=A7 >=20 =20 > Third one one: Improve func_get_args to return associative arrays. Thanks for the suggestions. Maybe add a new function func_get_named_args():= array, would be a good extension to the named arguments rfc= . =20 Regards Thomas ------=_Part_304342_979957016.1753813282174 Content-Type: multipart/related; boundary="----=_Part_304343_1128726760.1753813282174" ------=_Part_304343_1128726760.1753813282174 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
 
Gregory Magarshak <greg@qbix.com> hat am 29.07.2025 19:46 CEST ge= schrieben:
 
 
I came across this post on Reddit asking what people would like to se= e in the next PHP: https://www.reddit.com/r/PHP/s/l9r8UJP6Rk<= /a>
 
There are two major proposals I would make,  both of which aim t= o greatly improve PHP's competitiveness and ecosystem, while maintaining it= s spirit and what makes it great. And one minor proposal. I wrote them on R= eddit, but then I realized I should actually do something about it. The las= t time I did something was in 2015 writing to the PHP list back then.
 
How do I get rights to create my own RFCs for these? I tried to do it= on the web, but it says to ask on the mailing list. Here are my bona fides= : I've spent about 20 years with PHP, to be honest, and the last 14 buildin= g an open-source community platform / CMS that competes with Facebook, Twit= ter, etc. and uses very idiomatic PHP. Here are two links in case anyone is= interested
 
Anyway without further ado, I would like to present the two proposals= :
 
First one: introduce switch_global_context($name)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
I really love PHP=E2=80=99s shared-nothing architecture, but when it = comes to frankenphp, swoole etc. it is very hard to port existing apps to t= hat evented runtime. That is mainly because the superglobals and static var= iables are =E2=80=94 well =E2=80=94 global. You can have the best of both w= orlds.
 
Just add a function to PHP which can do context switching between all= global scopes, to any named scope. So when you have one evented runtime, i= t can quickly switch. This should be easy to do with SHM (shared memory seg= ments) and just pointing to a different page in memory. 
 
The goal is to allow all =E2=80=9Clegacy=E2=80=9D code (ie all curren= t PHP code that runs on php-fpm etc) to be trivially ported to much faster = runtimes, while remaining =E2=80=9Cshared-nothing=E2=80=9D for all intents = and purposes (global contexts would be isolated from one another because on= ly one could be active at a time).
 
Second one: set_encryption_seed($name)
 
You might need to let people register functions to run before a conte= xt is saved (sleep) and after it is loaded (wakeup), when there is memory p= ressure, PHP can handle this in a standard way and even encrypt it at rest.= You can also do this for session save/open handlers (which you already do)= .
 
Just have an environment variable or function like set_encryption_see= d($seed) at startup of frankenphp or swoole.
 
Third one one: Improve func_get_args to return associative arrays.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
I had this suggestion back in 2015 but maybe now it=E2=80=99s outdate= d. You see, functions typically start out having required arguments first, = then add on optional arguments later. I thought based on how PHP passes arg= uments, it would have been trivial to enhance func_get_args to return an ar= ray indexed not just by numeric values but also string values!
 
And therefore one could pass arguments like in python: func(2, 5, $fo= o =3D> $bar, $baz =3D> $choo) It also would look exactly like the fam= iliar array composition syntax. But this is no mere syntactic sugar. It hel= ps developers fall into the pit of success by creating backward-compatible = interfaces and making any function extensible, improving the entire ecosyst= em.
 
Sincerely,
Greg Magarshak
 
3D""
3D""==E1=90=A7
3D""
3D""=E1=90=A7
 
> Third one one: Improve func_get_args to return associative arrays.

Thanks for the suggestions. Maybe add a new function func_get_named_args= (): array<string, mixed>, would be a good extension to the named argu= ments rfc.
 
Regards
Thomas
------=_Part_304343_1128726760.1753813282174 Content-Type: image/gif Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 ------=_Part_304343_1128726760.1753813282174-- ------=_Part_304342_979957016.1753813282174--