Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:124782
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 D1C0E1ADA99
	for <internals@lists.php.net>; Mon,  5 Aug 2024 17:11:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1722878009; bh=SHj/uacgpFWTABqRZc4WOIhcwW32yeCs4VUUP0uNn04=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
	b=Aq6jYxSv5hhmtVxxeJM+nTvofk18HJSQAW5XIPm7anyLjPHtxr+qpPCqNO4lAFF94
	 e+wMJe5hh6OxvWjX03FAQ9WZ0Hdyx2C4bBcyBar6GZqUvhyLdhzFYl2pjbvgMm1Qdg
	 nqB+9N+DM2U012xX+lM7SsL/ufREHsZz5F63TPTWgHeTGYM1F2YxoXSa0mkm7At1J/
	 6s7C2VChqNe9Elr9uGuFUbaVwGdZc6iUrFH/Inxc6Vk4FQlL0XjGqxAXJAhDCLxiMm
	 aqb/lP0bEdt4OZQ2v0nIdxurYA9PJsPo8v2NywxN290s3pZ6a4iZ1hiGHC1an21+yj
	 cKrEKoi7zjCMg==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id B9F9A1801E0
	for <internals@lists.php.net>; Mon,  5 Aug 2024 17:13:27 +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,SPF_HELO_NONE,
	SPF_PASS autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <tim@bastelstu.be>
Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72])
	(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 <internals@lists.php.net>; Mon,  5 Aug 2024 17:13:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be;
	s=mail20171119; t=1722877904;
	bh=6C+UhNfR4maUFRf/MMj8XwAy4HdTONnQZVzK5EfkjT0=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type:from:to:cc:subject:message-id;
	b=F1tjFXcU3NmjtQnBgOLnfDBq44xiNBeSwYJhisoswlX2cw5/KS3P39uH7QDxBLS2I
	 aoHsO1VTWkEWxDmaBCI+8y+SCkb/K+t2yzjvvFLAjYiYS9d3NXX2uXZwZh+tWFjdSi
	 RUDU0r+6jjISJf9KQQ08+ZtyCRdCUxLyQUr/HklhWQxxofb9gnX9l1eex5A8Ql7O2s
	 ghX+74CQ02LDX56UxM8jWm26CzroNCt+IwT8kgrulHouioVQnoa0kfzeSaKGf/yRkJ
	 8yFhT/LUtDqIZPkRvc8y+gJTt+iX4lrcydoqGOSMoRgCdbLpbaJb6QS/OXTk4rrgJv
	 2X+aP5crwF5oA==
Message-ID: <d7cd95e4-978e-4fd8-8a80-027c76fc3bbb@bastelstu.be>
Date: Mon, 5 Aug 2024 19:11:43 +0200
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
x-ms-reactions: disallow
MIME-Version: 1.0
Subject: Re: [PHP-DEV] [RFC] [VOTE] Transform exit() from a language construct
 into a standard function
To: Levi Morrison <levi.morrison@datadoghq.com>,
 "Gina P. Banyard" <internals@gpb.moe>
Cc: PHP internals <internals@lists.php.net>
References: <WAN6ETlWt7JfcVoyeYfY_F_eLE6WzQa87F7yi8SHISmyktMYx7YcA6oG5dis3gFeI36VBjSfjGw4AT6psFFDXEUNRrvKRRn4LxfdCxFBccw=@gpb.moe>
 <CAAKU0unkZ6Tc4NZ3Yqpsq5ef_ya+QfvEv8j-7wqcbL5FtW7-Mw@mail.gmail.com>
Content-Language: en-US
In-Reply-To: <CAAKU0unkZ6Tc4NZ3Yqpsq5ef_ya+QfvEv8j-7wqcbL5FtW7-Mw@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=)

Hi

On 8/5/24 18:06, Levi Morrison wrote:
> After thinking about this several times over the course of discussion
> and again now that it's in voting, I have decided to vote no. I am in
> favor of this change, I just think given the concerns it's best to
> wait for PHP 9.0 to do it. Maybe the concerns with control flow can be
> improved by better inference/marking of functions which are
> `noreturn`, at least for known functions (of which `\exit` definitely
> would be).

As I've just explained in my response to Derick within the discussion 
thread related to this RFC: The information is already there, it just 
needs to be used.

For a test I've just added the following code snippet to 
`zend_compile_call()`:

     zend_type return_type = fbc->common.arg_info[-1].type;
     if (ZEND_TYPE_CONTAINS_CODE(return_type, IS_NEVER)) {
     	printf("%s has return type never\n", ZSTR_VAL(lcname));
     } else {
     	printf("%s doesn't have return type never\n", ZSTR_VAL(lcname));
     }

and then I executed the following test script:

     <?php

     namespace Foo;

     function a() {
     	\strrev('foo');
     	exit(new \stdClass());
     }

     try {
     	a();
     } catch (\Throwable) {}
     echo "executed", PHP_EOL;

when running this script, I receive the following output:

     strrev doesn't have return type never
     exit has return type never
     executed

Best regards
Tim Düsterhus