Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:131041 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 2C3491A00BC for ; Thu, 28 May 2026 18:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1779991725; bh=4T1I7Zzl+ANzgWOwZr0rarCkcN0AjBq4UVeEXOqznuE=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=UAiaUosFasN284psSBSd5hT/yJj3CkX4TxKcQYRVvtswA3fye9FL7VFuXjRZPKT0R MgotMS81M7FyaVzaWrcnaLpv3wupanjjV5ZYBnRFIlkypneW04IiJndLZ3U0baJVAo hInTYv9SDqAX7LkfCG23v5C8DZgISBs7Yzzx6sv13onX0915JNJGu4j97xm0riC8jo g4NHf0fKFGTS6PxSe/CBJqEgGTsy1X8xTOUwD6t58FQK+0vamaKGJE5Oe0zDU36kQE qpK7D4t1dMj+5LjyK3CpZj9zV7mOTNNL/Ujf1bghHd6x8AecBmSwaaRoS5K4GXyhAY BSzK1LfEjdfoA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A8C261801D4 for ; Thu, 28 May 2026 18:08:44 +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=1.9 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FORGED_GMAIL_RCVD, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 18:08:39 +0000 (UTC) Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-44c350a5b87so7718081f8f.3 for ; Thu, 28 May 2026 11:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779991713; x=1780596513; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=ZVFHlKhcNl0WhJpRXZskulNQroprq8t6JyZpO1w84Yg=; b=BfSbz+7k5IgvoiqYDrtrVcVIvxIMit/aY2z4sVg2sast5VQEpzfTXQWPAlPiGTw9Mi FXUVaJvWWMKC79+0VeQV0YEvD5DYAII3eFEW/sE018wN3q7R1sIprcVyDRgdxGuhS52q Fv8wI1B2QB6/Z0XrqzhMVQIjjSRUAVd/6jFVShpcGqzH7KK3rJXD0WPcNWv6XucFc9XQ LR0ijZnuIopJE1GWgkmvMhMSpN5b0m9Xn7ah0U8HSuBeBiczTDOohLkMO84lZ/uzrTUR KrKHYeLnoHUSg4RR0qosX+8bM62GYiA1Atkb1K+l0oyLlut0kqrrNXzGNDy39IQ+FN+Q y/bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779991713; x=1780596513; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZVFHlKhcNl0WhJpRXZskulNQroprq8t6JyZpO1w84Yg=; b=rqIOslv8Nh5YSrnwLZgS0YTRRNNulbXVZfztW9k8R7np7f8TVRlS1PI0nJqAKPat4a EtgxNig6VwxQd34ii7S1LoGZQ7NLOT4++kqvfvGLE/d01iughARVCwN6Qn7e/m2VMnAB vZqIoU7alkYxajOigEw/x4hkz4hew4lzWGIOLK7xV48KVcnqnEXTopmJL+XJzufAIzB4 yDOnfHZefh+4/YW1wdeg591pJAqhkfy4+W5sQ4Fe2FAYO42taZPDwjyFzFBubUa+HnOj odLWsoZVFF3Q1Y1zmOEJfxBXWCx3AymDcnVxLmKSv0YMtxDzRxTcyXq8dPDxoyZ6m6qE 7CUg== X-Gm-Message-State: AOJu0YyGn76ju7rv7UQWPm6gybtTHNEiUh1YtmN/j0HeALE7J6G7Rzsf lkoJveGYYISGyZ6VsCLJtcVj0dyBqrwiQNjoRbGyvTOYxCoHv4nWIgfk51A8JNcM X-Gm-Gg: Acq92OEIxQgDuU7YsXb1unqNn+6LCHpqzEidM17/GzhFyNh/ltwyBYmc23HMn1LTnq0 Ja37FVQdR7Pst92TIr6Pw1oLiHM6TkXAE9Ut3gOSOPLHoyKMyljaToNA+B0Q2vefnnlO4xaNvzl h3vPRvhZ7EVZvUkOh02RBCN+ljaX809+s7VTVY1eub7axE1GqRMQfkuzaJBM1htWfkZwGEotqEk qoyjo2c8jVxv/J2bM4xNtU8Ken8ZQgKCDJ5uefdTl9S/VILPBUBpCvWvvhr0tug4DToaJrJ89tQ KkcsuATAkSG+uYLJ3TYTMbApqkGm4YNWXwiuDc2nVrmMpYfJJeEQIdPgV9yFl0vt+TBNZJetWYj m+J3a4hZEL3Sx8EcMdPh58DP02wBd1QQN6vddBdHBnpQpF2Eink4qArMIV7IvzS7pCzy74ca2iv Rt6xGRTOaCfS3CXZUU5s4lTuPd/ioFtXW6/Te5QQTeQOFFyNsJIX330r0P2QQIf97xZebTHB5+L FcDeQw3EfPEKA== X-Received: by 2002:adf:fc0c:0:b0:452:c9f:4b91 with SMTP id ffacd0b85a97d-45ef029ba13mr316495f8f.4.1779991712901; Thu, 28 May 2026 11:08:32 -0700 (PDT) Received: from smtpclient.apple (p508ccfb8.dip0.t-ipconnect.de. [80.140.207.184]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45edb5a2a07sm14088938f8f.19.2026.05.28.11.08.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2026 11:08:32 -0700 (PDT) Message-ID: <06617C42-EA74-4369-BF6E-0DA8CDC225A2@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_169B099E-5333-464A-96F5-1E34D05E5BEC" Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [PHP-DEV] [Pre-RFC] Pure-code source files via .phpc extension Date: Thu, 28 May 2026 20:08:21 +0200 In-Reply-To: <671b98c9-b3dc-47d7-84ae-dfba1efa0e26@app.fastmail.com> Cc: PHP Internals To: mjec References: <9E95EA03-B86A-D248-A980-B1E838F94C13@hxcore.ol> <11B6D9B0-2555-4FC4-B540-71680315589F@gmail.com> <671b98c9-b3dc-47d7-84ae-dfba1efa0e26@app.fastmail.com> X-Mailer: Apple Mail (2.3864.600.51.1.1) From: hmennen90@gmail.com (Hendrik Mennen) --Apple-Mail=_169B099E-5333-464A-96F5-1E34D05E5BEC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Am 28.05.2026 um 19:14 schrieb mjec : >=20 > I'm not a voter, but I have thoughts. >=20 > 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. >>=20 >> 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. >=20 > 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. >=20 >> 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. >=20 > 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. >=20 >> > 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. >=20 > 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 `=20 >> 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. >=20 > 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: >=20 > php -r 'echo = empty(array_filter(token_get_all(file_get_contents("/path/to/file.php")), = fn($t) =3D> $t[0] =3D=3D=3D T_INLINE_HTML)) ? "OK\n" : "Contains = non-PHP!";' >=20 > 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. >=20 > mjec >=20 Hi mjec, Thanks for your mention about LLM usage - yes I use LLM in my daily work = but I=E2=80=99m also a developer at senior level with 10 years of = experience - much less than most others :-) I=E2=80=99m fairly new to PHP Core / Extension development - that=E2=80=99= s right. I don=E2=80=99t trust LLM output blindly. Because of your point =E2=80=9E4. PHP has several braceless syntax = control structure commands Yeah - this was out of scope for this RFC but I wanted to address it. - = The core of my intention is clear the option to get rid of Hendrik= --Apple-Mail=_169B099E-5333-464A-96F5-1E34D05E5BEC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Am 28.05.2026 um 19:14 schrieb mjec = <php@mjec.net>:

I'm = not a voter, 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 = 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 `<?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 = something that has a different primary purpose. To be honest I would not = consider this a reasonable position on this = RFC.

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) =3D> $t[0] =3D=3D=3D 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


Hi mjec,

Thanks for your = mention about LLM usage - yes I use LLM in my daily work but I=E2=80=99m = also a developer at senior level with 10 years of experience - much less = than most others :-)

I=E2=80=99m fairly new to = PHP Core / Extension development - that=E2=80=99s right. I don=E2=80=99t = trust LLM output = blindly.


Because of your point = =E2=80=9E4. PHP has several braceless syntax control structure = commands

Yeah - this was out of scope for this = RFC but I wanted to address it. - The core of my intention is clear the = option to get rid of <?php and = ?>

Hendrik
= --Apple-Mail=_169B099E-5333-464A-96F5-1E34D05E5BEC--