Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128302 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 AC9DB1A00BC for ; Tue, 29 Jul 2025 17:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753811087; bh=Gw+nMXxJUlt47FZnMuoM+Fqu8pH/W79Djgwt+T3IArE=; h=From:Date:Subject:To:From; b=VMY5+vhPNJf5tdLJ73OgOuJnBRLikXRuG7JMKEWR9hOvAvzdVE/79lwbrua1G7IVK 6HyQXPsZ66Lg/f4TfUDcctTxpuNcEhzngMo8WJJqBAhGDdlNbhPdjzI3LZIxojM0tv 54IdqbMo5bt1nBloej08lxstr9U6vAkdvH3rvW/OBSoDGuzmPaZKTZ34G8KhpuUBJv LesaNH3HTQDXXPTvHOIGt6B8BYtuhisFtgXG6oVDd69m+McS4qYimFMfLqr9FwaZGS RpWENNUhddGrJZiOI6/u4c3SQJDPZo4/pfIuFdHpjmkizPywEhHIjTWYOWLXqf/yOA +4TTqIZ3w4Img== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E27DC180048 for ; Tue, 29 Jul 2025 17:44:46 +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.9 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_FONT_LOW_CONTRAST,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,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 mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 ; Tue, 29 Jul 2025 17:44:46 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-315f6b20cf9so6406404a91.2 for ; Tue, 29 Jul 2025 10:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qbix-com.20230601.gappssmtp.com; s=20230601; t=1753811187; x=1754415987; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=5YzTW9cdxxDq9mue1tXWtlTu6PFh2Yrxbh4gv0KBCKA=; b=EsMvcNVKYfGVyia6+6narbj1yhqf+TehZ+MZNAhxitms6ocn8vk/bnlcI53+kSLaVY 5jbcmGuvIgIiAU+wsKpRvY+fegqamLXp1ClBoEC2nxiYdmCy9uibqpcWJjmKo5Ovw+H/ Wti1Anq/niuPZ0P7Bdu1Yc0fqC/IQJ4N+cXk/ynSrI6B8cAfiykfcJY4mqwU9+ooIlBg J2dnikPwd//GhhAwmQoZgPojmczXBkV/APmcLMyHQID5yRoRz8wgjJNwyAQsCBvGk98q hwSz8iyqN/Z9JDAyK+WuxZ335NDtejLt39c1nMtsfMvfpDZ4A/2s3yoRC4yO9NJIv8Ta nm9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753811187; x=1754415987; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5YzTW9cdxxDq9mue1tXWtlTu6PFh2Yrxbh4gv0KBCKA=; b=gB0Pf0S9wQ7d6Fyj0gVObCFhhYhRVDbCgO5pRYZsOQdda8eL/8LpG/5WVerVkPlKPn DGafZgKh00PYFIEIASxW0bedu9kInQe9L7Bk8ooWvHVxk6WLy2byhmoheVWlRAXEHrCc tdH5N84m2M+tD7KtF+TV1SVmRoKS6idErkZCTa3yhXyH9IVMaSm7RC661MqXAEuHnlvO cugcMwUQaEACi8O9aGHVs5S6NrD5el0EgUZDCuWCYkHXq8k1HdrF2ghxpTl3E29CivYl q59DP3dXsdW4YBYAzi5M9VqIQA95+Dk+5MrbMv2Vz9YEayCz8NWW3nrojP39FlESTKNd QaGQ== X-Gm-Message-State: AOJu0YwjVVjKW6V1X8SGN4fbDLFkdEqmUnTSIDESYBoS5DynWEEBpDs3 BuGfTWYwjb+8GLqvZSB3D4JC3JlBfMdUdSXwrxFteTT9pfeY4rpUxY8NEyQMMI6Kbjw3iigD5tP /KjAx/GRLXRinHqMrpmGZx+2OcswOTeWmz92LoKbr5nJTWT/QEw9l+hc= X-Gm-Gg: ASbGncvtujfwnS8rJvXVvb6SOTKwEyhbYBj9NmmLFSc0n7PxOBlSbngXhvZc4lT347f Ti9g7OhxLx9mzV6uRq0Kfj1c30ZAE/JSheaUB9Hvkx4H8/4Sh0Jyfq3JguckofSKbiF7UA2scQe Bxh92X9/ijUcW1IpKwBghcc02t0UIadBb4XgzlU0k2dowiXz7jgyQkgQfnORPDcTaA6Horux+xb u47wQ== X-Google-Smtp-Source: AGHT+IHXfT8mXm88zB5mspDo1XFka9P4eXZcR+soSUHx7krbaaRA6lDNwNhjyQUTXfpjfElVB5mCXJOBy3QVzWRJ3sU= X-Received: by 2002:a17:90b:3145:b0:311:e605:f60e with SMTP id 98e67ed59e1d1-31f5de96a5cmr521141a91.20.1753811186890; Tue, 29 Jul 2025 10:46:26 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 29 Jul 2025 13:46:15 -0400 X-Gm-Features: Ac12FXwFam4HjsDLwmiRx28XWuHPAkjG57i3zSUXzMs1Z287vZwZPO2gUvlynSk Message-ID: Subject: [PHP-DEV] Three proposals for PHP 9 To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000cc4d4f063b14fc6d" From: greg@qbix.com (Gregory Magarshak) --000000000000cc4d4f063b14fc6d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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, but 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. 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 interested https://github.com/Qbix https://www.laweekly.com/restoring-healthy-communities/ 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 that evented runtime. That is mainly because the superglobals and static variables are =E2=80=94 well =E2=80=94 global. You can have the best of bot= h worlds. 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, it can quickly switch. This should be easy to do with SHM (shared memory segments) and just pointing to a different page in memory. The goal is to allow all =E2=80=9Clegacy=E2=80=9D code (ie all current 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 (gl= obal contexts would be isolated from one another because only 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 context is saved (sleep) and after it is loaded (wakeup), when there is memory pressure, 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_seed($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 outdated. You= see, functions typically start out having required arguments first, then add on optional arguments later. I thought based on how PHP passes arguments, it would have been trivial to enhance func_get_args to return an array indexed not just by numeric values but also string values! 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 array composition syntax. But this is no mere syntactic sugar. It helps developers fall into the pit of success by creating backward-compatible interfaces and making any function extensible, improving the entire ecosystem. Sincerely, Greg Magarshak =E1=90=A7 =E1=90=A7 --000000000000cc4d4f063b14fc6d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I came across this post on Reddit as= king what people would like to see in the next PHP: https://www.reddit.com/r/P= HP/s/l9r8UJP6Rk

There are two major proposals = I would make,=C2=A0 both of which aim to greatly improve PHP's competit= iveness and ecosystem, while maintaining its spirit and what makes it great= . And one minor proposal. I wrote them on Reddit, but then I realized I sho= uld actually do something about it. The last time I did something was in 20= 15 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 i= t says to ask on the mailing list. Here are my bona fides: I've spent a= bout 20 years with PHP, to be honest, and the last 14 building an open-sour= ce community platform / CMS that competes with Facebook, Twitter, 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 on= e: 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 v= ery hard to port existing apps to that evented runtime. That is mainly because the superglobals and static variables are =E2=80=94 = well =E2=80=94 global. You can have the best of both worlds.

Just add a f= unction to PHP which can do context switching between all global scopes, to= any named scope. So when you have one evented runtime, it can quickly swit= ch. This should be easy to do with SHM (shared memory segments) and just po= inting to a different page in memory.=C2=A0

The go= al is to allow all =E2=80=9Clegacy=E2=80=9D code (ie all current PHP code t= hat runs on php-fpm etc) to be trivially ported to much faster runtimes, wh= ile remaining =E2=80=9Cshared-nothing=E2=80=9D for all intents and purposes= (global contexts would be isolated from one another because only 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 context is saved (sleep) and after it is loaded (= wakeup), when there is memory pressure, PHP can handle this in a standard w= ay and even encrypt it at rest. You can also do this for session save/open = handlers (which you already do).

Just have an envi= ronment variable or function like set_encryption_seed($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 sugge= stion back in 2015 but maybe now it=E2=80=99s outdated. You see, functions = typically start out having required arguments first, then add on optional a= rguments later. I thought based on how PHP passes arguments, it would have = been trivial to enhance func_get_args to return an array indexed not just b= y numeric values but also string values!

And there= fore one could pass arguments like in python: func(2, 5, $foo =3D> $bar, $baz =3D> $choo) It also would look exactly like the familiar array composition syntax. But = this is no mere syntactic sugar. It helps developers fall into the pit of s= uccess by creating backward-compatible interfaces and making any function e= xtensible, improving the entire ecosystem.

S= incerely,
Greg Magarshak


3D""
<= div hspace=3D"streak-pt-mark" style=3D"max-height:1px">3D""=E1=90=A7
3D""
3D""=E1=90=A7
--000000000000cc4d4f063b14fc6d--