Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117979 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36131 invoked from network); 17 Jun 2022 13:32:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2022 13:32:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 05C821805B6 for ; Fri, 17 Jun 2022 08:20:20 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 17 Jun 2022 08:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1655479217; bh=4l+5ma5ckbSTi0Y/RCBsDBJP4I7WdfWK3upjRajVSw8=; h=Date:To:From:Subject:From; b=ifeHzJeWkgDiVpv4CaoUAKQQc1D642pJ0X7KsZZ/+kzDtcCz3+kQ7MCKUvv1KqM2O gDlG7EpgH2vApG9Vu/hFt//WI4abXn0MjT0vJwzpb3y8R0Gqz1YBF6eWP6RTY+ydBJ j63E9iKJzyhBm6/vIjpuYDk9+AS9fl4mHf6QKujsDPllHx9kuAPzu8KI3inzcFN3jj 86Q7f95IdSUgMpnt9VMYfjTLb4yhaszXEq4feIaAOG5gVtZi1jvys1J0FKv1TZhoLA Luc4b3SlOnAPcTwZ0tJn2yyHda6fsgKuqgaoWWU+0SNNHz0sr1z6820MReXj/cstNp dRIZRYX5kfV9w== Message-ID: Date: Fri, 17 Jun 2022 17:20:15 +0200 MIME-Version: 1.0 Content-Language: en-US To: PHP internals Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Make iterator_to_array() accept all iterables From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi Internals I've come across a case where it would've been useful if `iterator_to_array()` would accept iterable instead of Traversable to avoid checking whether the input variable already is an array. To not repeat what I've already written in my proposed PR, please see: https://github.com/php/php-src/pull/8819 for more details. In response to my question whether this would require an RFC or whether this is simple enough, cmb pointed to a previous RFC that proposed *adding* a new function `iterable_to_array()` which was declined: https://wiki.php.net/rfc/iterable_to_array-and-iterable_count cmb also suggested that for this reason this topic should at least be shortly discussed on the list, which I intend to do with this email: - Do you believe that my PR requires an RFC / do you want to see an RFC for this? - Would you object to extending 'iterator_to_array' from Traversable to iterable (i.e. to Traversable|array)? Best regards Tim Düsterhus