Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122528 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 0A20C1AD8F6 for ; Tue, 27 Feb 2024 22:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1709072001; bh=wFQ6wTW7z+YXbmv2e66B9i3B5C6Vl8xUbtw6wCVHyME=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=nmmeSteZW4WcPbZzJrjVxXXGIT63AioQtcjOTvvYKJboxDSu3N0bPpU47iJSydng0 49kztV+SM3hfQ7osXsj8WpmIel5p4mHozuKLDUDRzeb5bo1wD9NhVtXbrfHUx89/r8 zlOt0bapb+mLUlH9BMrADrqKFNyx5Q20474zPm0byr2UcdByqjVAgGfNNpaaPad0vA MkJ5d/OwghehzC6IEATrCOd4Sqn3o8WShhvezoV8goaObsQVVRi6Q1CmChldX6fkDo /vJNzFtbKWLnDeaU2EZyMWR5rkJ4jWALMzae42fPGHO/OjoQ8rYWQOhxw6tb4MYMDn vW1/RlGn0h1Hw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2D574182A84 for ; Tue, 27 Feb 2024 22:13:21 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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, 27 Feb 2024 22:13:20 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-51197ca63f5so7192357e87.1 for ; Tue, 27 Feb 2024 14:13:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709071990; x=1709676790; 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=BoWcQLKw7FktZaC/3TxT3oEFshwVoVsGWXs19j8E234=; b=GPJqNx5mcPPLxDXQxiGapwAc5k9d663rgpEI2yOvkQMwloXked3RviouyWHy4etnnP oTlPMKM4zV1Tjrn5Hen5KSg/BJgo0hzyq7cgzYzKdFpCjREcsb8rY1wFj6BvEFSOWhvQ e5SLvk+kpQJE1VYfKqaWU/9nZV82rWj3YAbX5WyNH3kKBnIlhrOcQC9kzAJcmtaPbvBa JXuhHUhc2Fn6iRFhP48+RB8onndvo11AjFwfDVytHEVOWRR9jYWD1OSGioSIn0vEmjuQ LWfMI7WSSaym9+amrUqjZofBVWCvE4X448rf7uYxGSonssoaRvglv6TX23wszHJ/0FBG goTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709071990; x=1709676790; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BoWcQLKw7FktZaC/3TxT3oEFshwVoVsGWXs19j8E234=; b=GIh4sHbyLA8tZr9ugV1oSBt9zcG6fbT79W3fBEVf7svqG3+7njm/8BFrvsDxrGsT3Y DkhVVgbREQ6WIWoULKQl4bD/ojHJOE/RD+N++HOD6ATWXaGEXBXh20ZZMJG2A9iasKki TmRStzO3BYpfvbS1oLq7bYq9EHTVP7pO55ZOFuY4lwkeji+PcUckVa1ipOcst2bXFdoE /hgi66akKkynPQev8Uj/7/meDw+T8iR0fxOx2hrzObR4ydyANfYCmIVqisu1SUyvExWX nNVN01ppu5/FNBPtcZkzi3/4kLjDZ2MTEvgiIH6sSzb1y1R84EMt4ZvK7jm0x7ZUwRLX C0ew== X-Gm-Message-State: AOJu0Yyy9P4C4YLOOKaAwd20/bN/njuX9BNs/iSarlbQze87fhndKZFn UX3ahQIP2T07RphYra+i8vQe3FiOnOMAd1d3XXtQTeW7bfVMseUtgaGSswNJ X-Google-Smtp-Source: AGHT+IE25wCuB8r4KBOC1iS/dwHTZoBxUpK7+PttiCabXUO9FcG/qW/HG3ay0VFSsHqZhJuwQCgo8w== X-Received: by 2002:a17:906:3c15:b0:a43:49ca:2473 with SMTP id h21-20020a1709063c1500b00a4349ca2473mr723199ejg.0.1708898844351; Sun, 25 Feb 2024 14:07:24 -0800 (PST) Received: from smtpclient.apple ([178.197.198.44]) by smtp.gmail.com with ESMTPSA id w9-20020a1709064a0900b00a3d153fba90sm1793026eju.220.2024.02.25.14.07.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Feb 2024 14:07:23 -0800 (PST) Message-ID: <2958150F-5CA3-4D7E-996B-AC3F452E8AFB@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_05D25569-EFC9-4B20-87F9-BB52C0BA1BC7" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Subject: Re: [PHP-DEV] [Pre-RFC] Convert exit (and die) from language constructs to functions Date: Sun, 25 Feb 2024 23:07:11 +0100 In-Reply-To: Cc: PHP internals To: "Gina P. Banyard" References: X-Mailer: Apple Mail (2.3774.300.61.1.2) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_05D25569-EFC9-4B20-87F9-BB52C0BA1BC7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 > I hear you, but what about exit; ?! > Do not worry exit; is still supported! > It only requires a _tiny_ bit of dark magic to achieve this! > exit; would just be interpreted as a fetch to a constant, > so when attempting to access the undefined exit/die case-insensitive = constant > we just need to exit as if we were calling the function! >=20 Hi Gina, If it is mostly an implementation detail, this is probably ok. However, = please make sure that `$foo =3D 'exit'; constant($foo);` (or any other = future way to interpolate the constant) does not stop the program, but = only fetch the value of a =E2=80=9Creal=E2=80=9D constant. Alternatively, it is probably possible to keep the current parsing with = T_EXIT, but to make it equivalent to invoke a =E2=80=9Cregular=E2=80=9D = function named `exit()` =E2=80=94 somehow the same way that using the = backtick operator is equivalent to calling `shell_exec()`, up to the = point that disabling `shell_exec()` will also disable the the backtick = operator? (BTW, it *is* currently possible to define and use a constant named = =E2=80=9Cexit=E2=80=9D: https://3v4l.org/aBq2R =E2=80=94 of course, no = need to keep such a =E2=80=9Cfeature=E2=80=9D.) =E2=80=94Claude= --Apple-Mail=_05D25569-EFC9-4B20-87F9-BB52C0BA1BC7 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

I hear you, but what about exit; = ?!
Do not worry exit; is still supported!
It only requires a = _tiny_ bit of dark magic to achieve this!
exit; would just be = interpreted as a fetch to a constant,
so when attempting to access = the undefined exit/die case-insensitive constant
we just need to exit = as if we were calling the = function!


Hi = Gina,

If it is mostly an implementation detail, = this is probably ok. However, please make sure that `$foo =3D 'exit'; = constant($foo);` (or any other future way to interpolate the constant) = does not stop the program, but only fetch the value of a =E2=80=9Creal=E2=80= =9D constant.

Alternatively, it is probably = possible to keep the current parsing with T_EXIT, but to make it = equivalent to invoke a =E2=80=9Cregular=E2=80=9D function named `exit()` = =E2=80=94 somehow the same way that using the backtick operator is = equivalent to calling `shell_exec()`, up to the point that disabling = `shell_exec()` will also disable the the backtick = operator?

(BTW, it *is* currently possible to = define and use a constant named =E2=80=9Cexit=E2=80=9D: https://3v4l.org/aBq2R =E2=80=94 = of course, no need to keep such a = =E2=80=9Cfeature=E2=80=9D.)

=E2=80=94Claude
= = --Apple-Mail=_05D25569-EFC9-4B20-87F9-BB52C0BA1BC7--