Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123448 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 884171A009C for ; Tue, 28 May 2024 14:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716906440; bh=Bjz1+slppwwxsGy7az+SNE6CAwmwlk2Mat0zvDpySBg=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=Ina8wU5LppM1YIkJi7qK0ELBfFRAolGCWw9b0G6h0PiTIY1Qewi/qQ9uvG51UllLH gYO2Y7NW58/8Fh4Ph3l2QL90IY8yRSlZNWX/miEQVT7vzLXHwWBj8ua0W5UmmFU1lZ aEpRGXBt8VBa0yu56sT9PlNvGT9IWydXaQLBCOoVaICAyiQADV7H0hLh26sAVnxYPm zNqKaCenTv3qxEz7vbtHoN1sJgeN94MPGD7Jybdcd10X9PWpahCUG5D4BAFNFH7MvF opPWeHAYgo/hLqcHVrh/fgQ/HZwxmGyXCZnuUOn5QRurMXUIorOFM7FFZyFVhxeyRN XXl4zNeYeb6ig== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CC47E18007B for ; Tue, 28 May 2024 14:27:18 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) (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, 28 May 2024 14:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716906376; bh=Bjz1+slppwwxsGy7az+SNE6CAwmwlk2Mat0zvDpySBg=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=n20bOUC3a3a3UdFq8WgLg4DiOylq+5zqzWbkiu8HxEBwuI7uh9R4NIm9sBtpz3Eps 4Tf1GuDDY6dlvpgHAfoLCFSJIHi46NnNKaEcNuKq+/On51kWSL2LQZVdXIrE34v5Ik eHsJvnhPrhtuwgH+ENujP5UJxWZHHXUfCQdv6sqjZD0Oy+o0/4S5m73JzTc4vTZjGD /opoztC8MWqaDWSROgTVealYdHqE2XsMTK+fUyoxaVQqCeaQo/0SF5eWlHnlqzzv8D jVuuGQLbSn2yIMEGI9NLL89BqvKBrbHSak1Knfc29OeWSGBQZh7zTK0LSFAmjWOKhT OPsiVGoIx06rg== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 9383F10C539; Tue, 28 May 2024 15:26:16 +0100 (BST) Date: Tue, 28 May 2024 15:26:16 +0100 (BST) To: Ilija Tovilo cc: PHP internals Subject: Re: [PHP-DEV] [RFC] Transform exit() from a language construct into a standard function In-Reply-To: Message-ID: References: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-25938924-1716906376=:61845" From: derick@php.net (Derick Rethans) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-25938924-1716906376=:61845 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 27 May 2024, Ilija Tovilo wrote: > On Sun, May 26, 2024 at 11:47=E2=80=AFPM Gina P. Banyard =20 > wrote: > > > > On Wednesday, 8 May 2024 at 14:40, Gina P. Banyard=20 > > wrote: > > > > > I would like to formally propose my idea for exit() as a function=20 > > > brought up to the list on 2024-02-24 [1] with the following RFC:=20 > > > https://wiki.php.net/rfc/exit-as-function > > > > As there haven't been any comments for nearly two weeks, I'm=20 > > planning on opening the vote for the RFC on Tuesday. Right now, I am not going to be in favour of this. Specfically because=20 the Backward Incompatible Changes don't list some of the backward=20 breaking changes, and no mitigations are provided. See below. I also don't see the benefit from doing this in the first place.=20 exit/die has always meant "bail straight out", without any function=20 semantics (from https://www.php.net/exit): =09exit =E2=80=94 Output a message and terminate the current script =09exit is a language construct and it can be called without=20 =09parentheses if no status is passed. It's not that this a particularly new or novel behaviour. I saw somewhere else in the thread that the exit construct could already=20 throw a catchable exception. I consider that a bug. > As mentioned early on in private, I don't see a convincing reason to=20 > remove tokenizer/parser support for exit/die. I'd rather see this=20 > handled in the parser directly, by converting the standalone keywords=20 > to function calls. This avoids any backwards incompatibility, and=20 > avoids special handling in zend_compile_const. >=20 > Another thing that's probably not too important: The PR likely breaks=20 > dead code elimination for exit() and die(). I have just checked this for Xdebug, and you're definitely right with=20 that. With the removal of the ZEND_EXIT opcode, it can not now detect a=20 scope/function exit now. It also breaks my "do tasks on ZEND_EXIT" with the profiler. It is used=20 to always write the closing profiling footer to the files. Without me=20 being able to overload thati opcode, data would not be complete. I even have two bugs (with tests) for this: - https://bugs.xdebug.org/68 - https://bugs.xdebug.org/631=20 Xdebug has been overloading ZEND_EXIT for nearly 20 years now. > This could be re-added by checking for the never return type instead. I can't quite see a way on how to do that? The EXIT is replaced by an=20 INIT_FCALL/DO_ICALL: 4 0 E > EXT_STMT =20 1 ECHO '55' 5 2 EXT_STMT =20 - 3 > EXIT =20 - 6 4* EXT_STMT =20 - 5* ECHO '675' - 7 6* EXT_STMT =20 - 7* > RETURN null + 3 INIT_FCALL 'exit' + 4 DO_ICALL =20 + 6 5 EXT_STMT =20 + 6 ECHO '675' + 7 7 EXT_STMT =20 + 8 > RETURN null The opcodes don't have direct access to the type mask structure as far=20 as I know. cheers, Derick --8323329-25938924-1716906376=:61845--