Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:131039 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 0935D1A00BC for ; Thu, 28 May 2026 17:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1779988477; bh=42jDNsCx1tsTTLBe2PsTnD1p43UnNCe/4F0sfdFWKbc=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=IFeK4VkyYaIugoKZD2LinKjgUFhUzZmcURntBNIVLhv7NyfvgDA3Ma7J3ulvwRPn9 UgRO6GJl/oFnMprzGwOR6ODMVaUVEPCOhpMdAAMETv8j1BtWP+Y706roLkof69oUPm HwusMUi5sHE3s7CxAyeRlJvewS9yBLXqISja/gpAU75KPFPiwGtpUWmMgqJh535GiJ XNPrBM2CRv/e49jLwr1YVLbMMPK+FfvfqJvIgyvZltQUVEHrufbnU8EHEelmn4yguC hn4vS1Z5+85aCV7d9fNfCHVrWsX1Je0luFI0QECvx/GHYyn6mcvUPCC8mPZ0x63FKo yg5SU7TKxmCzg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B93A18002E for ; Thu, 28 May 2026 17:14:36 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (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 ; Thu, 28 May 2026 17:14:36 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id D18F9EC0071; Thu, 28 May 2026 13:14:30 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-06.internal (MEProxy); Thu, 28 May 2026 13:14:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mjec.net; 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=fm3; t=1779988470; x=1780074870; bh=+ss/z8rXAd CQ7kVaG4c8MQ0X/qRSYLLQRwjYiDfw/sE=; b=EKZNEtDgO/ZdJayfA9LLkR3Ze5 WYRq1X7NEIlw5wqH37AQRTcgccm/87KDMS9MZjpDnjqHZaOnfcNomtcq+zx5Ya00 vDtADzMYS9plhu9kvRgxRr6yszxD8w1i8L24I65aM3yinCyN0dv4Mnome4OmIpyz fOcKTrcILZSPvRI0ZVs8vJDLE7NfrzJf4iaMuvdbOXlgN5KfhbCg2xTpO5y2vBdn KZy4DOFwxcqlZDevcjQo4RP7h/GUHosp/SUmMbDxFvCy+M8xBkbFXc3aPfC9zHd9 0l/l+bZkQ1T6AFbyVUMNEaFCB4hQSFb5eAXGfrE2Q7CbYJbLVDJhJv/2RHJA== 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-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1779988470; x=1780074870; bh=+ss/z8rXAdCQ7kVaG4c8MQ0X/qRSYLLQRwj YiDfw/sE=; b=kty2VudVXQ3yeQIPggQFo/9GktYVFumn7GOFM+nUtKJmYLtPyDL jjDpRtfp+ejOQMOrv8GUb8lhte/JLLveAmPhU5swhftkbP4P5XgO+34tIjsT7K5F n3JWhh2U4AOpzYfHueBiapMHg2DIJvOZxGQLHbCrTTxutoG9XTbCseDt/JWNWwDb Er370AzAUt1lsPepOcRh9ztVl4ASr1mWLu3HPWZ/WIK5QMhr+nmBXdHeiZSe6u6g vEt803ga5qRorl77xA75JXJkY1wOb/DHzi2uyuLAN07jo/2BAG5fZco1Q+dXk8kA oCmgpiVEGbUfT8RmFxH5rYMEgS9ZbtDcsGA== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTFHAyTzMQbe+7bxdUpCeyaMc3j9ZoyqJoQzSZFqcENbcEQI/V1w6bf23mvsUR3H4D 9pueBQ0PV8vR6z3mOPsUtyUkVYL3R7KLIncLYVWqU2aCf6w6il8KhLEZBpd6WkKhwF5yR+ c5hswFq70vZz4NlJhZO+eaUYibfui+HGU318dzrwjFtZpbnQN6GalfvfDvBZ58dbR3xaZ9 DLB3o6zG+giIF/YLin/olB2qJvjwde8gpzrlQiDfVdKFJjFb7ANST0mcuYhAU6v/8F9G0q 6PBSmfnzvRgG8LMyqNd+Ka0weV6ggSQ/t5MH/I5pWKiAQv9Gyic/MlCLoRxJ1xUuEaCPYe 9jTPnuqXntaPnh1D0+qbolafrE3L2iQJmrWov2hLKDn28r7xA8mgFDGZpAhWu1dzLAV0xL xsqzMESbvuxfTc1ZPLf7QnmiG9mU2xPUvZ0MR/P5KN1A4C/O2Hek+NWHx9VBZlINHTLa6w agdIb7uWe6XytBnQkuiXYeN7c+FOQYcOWZBiX25CV5AWEgUdgUt4Pi1WRRv9eERwqp3J6r lZjToXijiLw57FYQl+pXmDpR5AGlAkfrViG052ei7rOSqhW4gocinnlvfFZxM8ZJdUu1rN j2RmTozh5p5TQD/JEO13LPXYpUqW32XUl3Uwm8/JveY75D/bE8q2pARNbVEw X-ME-Proxy: Feedback-ID: iea414789:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 25A432400098; Thu, 28 May 2026 13:14:30 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 28 May 2026 13:14:08 -0400 To: "PHP Internals" Cc: "Hendrik Mennen" Message-ID: <671b98c9-b3dc-47d7-84ae-dfba1efa0e26@app.fastmail.com> In-Reply-To: <11B6D9B0-2555-4FC4-B540-71680315589F@gmail.com> References: <9E95EA03-B86A-D248-A980-B1E838F94C13@hxcore.ol> <11B6D9B0-2555-4FC4-B540-71680315589F@gmail.com> Subject: Re: [PHP-DEV] [Pre-RFC] Pure-code source files via .phpc extension Content-Type: multipart/alternative; boundary=1a7620e7f9ea5305f6e021fe02b05aad77e73a5b From: php@mjec.net (mjec) --1a7620e7f9ea5305f6e021fe02b05aad77e73a5b Content-Type: text/plain Content-Transfer-Encoding: 7bit I'm not a voter, but I have thoughts. On Thu, 2026-05-28 at 11:35 -04:00, Hendrik Mennen wrote: > > 1. Extension based parsing isn't a popular idea. The first few > > responses to this have echoed this, but there's a certain power in > > allowing the parser to not care about the extension. > > Fair, and I have heard this from both Ben and Alex earlier in the thread. My pushback there has been that the engine already has the filename available at zend_compile_file and at include/require resolution, so teaching it to check the extension is additive rather than architecturally violating. It's not purely additive. It's taking a thing that currently has no semantics (filename) and giving it semantics. Without this change, users are able to choose the semantics of the filename by choosing how to invoke the interpreter. After this change, that is no longer guaranteed to be the user's choice. > That said, as a complementary mechanism for explicit override or for stdin/eval cases where no filename exists, a require_pure or require_module-style call is genuinely useful. I floated this in my reply to Alex as part of a synthesis: extension as primary signal, CLI -p flag for stdin (Ben's suggestion), require_pure-family for explicit override (your and Alex's suggestion). The autoloader question gets simpler in that synthesis because the autoloader can dispatch on extension by default. Even ignoring the `include` issue, this is more evidence to me that the trigger for this mechanism should not live in the filename. Let users choose an invocation path (SAPI configuration) based on filename if they want, but do not make it a language feature. > > 4. PHP has several braceless syntax control structure commands - Would > > these stay around or should they too go away since they aren't > > really needed in a code first file. ... > Two reasonable positions: ... > (b) Disallow it. The new file format has the freedom to be stricter, and the alternative syntax serves no purpose without templating. This would be a big change from the original proposal, which was "pars[ing] starting in ST_IN_SCRIPTING". This is not just talking about skipping ` The accidental-echo / headers-already-sent issue is the real practical win. That bug class disappears entirely in pure-code files. I would list this as the second motivation in the RFC after the conceptual one. I don't think of this issue as big enough to require a language feature. You can already check for this condition with a one-liner without any additional tooling: php -r 'echo empty(array_filter(token_get_all(file_get_contents("/path/to/file.php")), fn($t) => $t[0] === T_INLINE_HTML)) ? "OK\n" : "Contains non-PHP!";' And finally, Hendrik while I appreciate your detailed replies, they are clearly LLM-patterned, and that makes me disinclined to read them. I understand if you want help crafting the words you use, but I just don't really believe you would have said anything like "[t]his is the most important point you raised and I want to be careful with it" (for example) if that hadn't come from an LLM. That means you're communicating its judgement, not your own. I do not want to start a discussion on this topic, merely to express my view. mjec --1a7620e7f9ea5305f6e021fe02b05aad77e73a5b Content-Type: text/html Content-Transfer-Encoding: quoted-printable
I'm not a vo= ter, but I have thoughts.

On Thu, 2026-05-28 at= 11:35 -04:00, Hendrik Mennen <hmennen90@gmail.com> wrote:
> 1. Extension= based parsing isn't a popular idea. The first few
>  =  responses to this have echoed this, but there's a certain power i= n
>    allowing the parser to not care about the = extension.

Fair, and I have heard this from bot= h Ben and Alex earlier in the thread. My pushback there has been that th= e engine already has the filename available at zend_compile_file and at = include/require resolution, so teaching it to check the extension is add= itive rather than architecturally violating.

It's not purely additive. It's taking a thing that curr= ently has no semantics (filename) and giving it semantics. Without this = change, users are able to choose the semantics of the filename by choosi= ng how to invoke the interpreter. After this change, that is no longer g= uaranteed to be the user's choice.

That said= , as a complementary mechanism for explicit override or for stdin/eval c= ases where no filename exists, a require_pure or require_module-style ca= ll is genuinely useful. I floated this in my reply to Alex as part of a = synthesis: extension as primary signal, CLI -p flag for stdin (Ben's sug= gestion), require_pure-family for explicit override (your and Alex's sug= gestion). The autoloader question gets simpler in that synthesis because= the autoloader can dispatch on extension by default.

Even ignoring the `include` issue, this is mor= e evidence to me that the trigger for this mechanism should not live in = the filename. Let users choose an invocation path (SAPI configuration) b= ased on filename if they want, but do not make it a language feature.

> 4. PHP has several braceless syntax con= trol structure commands - Would
>    these stay a= round or should they too go away since they aren't
>  =  really needed in a code first file.
= ...
Two reasonable positions:
...
(b) Disallow it. The new file format has the freedo= m to be stricter, and the alternative syntax serves no purpose without t= emplating.

This would be a b= ig change from the original proposal, which was "pars[ing] starting in S= T_IN_SCRIPTING". This is not just talking about skipping `<?php`, you= 're talking about defining new syntax rules. As you discuss, this is an = enormous can of worms, and I wouldn't want it to be tacked onto somethin= g that has a different primary purpose. To be honest I would not conside= r this a reasonable position on this RFC.

= The accidental-echo / headers-already-sent issue is the real practical w= in. That bug class disappears entirely in pure-code files. I would list = this as the second motivation in the RFC after the conceptual one.
=

I don't think of this issue as bi= g enough to require a language feature. You can already check for this c= ondition with a one-liner without any additional tooling:

=
php -r 'echo empty(array_filter(token_get_all(file_get_conten= ts("/path/to/file.php")), fn($t) =3D> $t[0] =3D=3D=3D T_INLINE_HTML))= ? "OK\n" : "Contains non-PHP!";'

And final= ly, Hendrik while I appreciate your detailed replies, they are clearly L= LM-patterned, and that makes me disinclined to read them. I understand i= f you want help crafting the words you use, but I just don't really beli= eve you would have said anything like "[t]his is the most important poin= t you raised and I want to be careful with it" (for example) if that had= n't come from an LLM. That means you're communicating its judgement, not= your own. I do not want to start a discussion on this topic, merely to = express my view.

mjec

--1a7620e7f9ea5305f6e021fe02b05aad77e73a5b--