Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118653 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58303 invoked from network); 18 Sep 2022 22:01:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Sep 2022 22:01:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 94542180384 for ; Sun, 18 Sep 2022 15:01:57 -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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 18 Sep 2022 15:01:57 -0700 (PDT) Received: by mail-pj1-f42.google.com with SMTP id q9-20020a17090a178900b0020265d92ae3so5098412pja.5 for ; Sun, 18 Sep 2022 15:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date; bh=S5q5SWPfTa40+OAUuVF3swPwR1BfDxh1cBi++Y0wgbk=; b=Hh4oGZJsoi+8gDN/4KcLruUqHkkeRcCJbarUD8ytK/2SkBl9Yd/G5aNXXp9l98enxe vFlRjMMJe+FBi+jUapeADz2AsT5mGxPLhNKFXwMUgVw/zkykEGoyD3KI6uDCflYGuqb1 RtLxfQHTsaUIaDWCk0lwWi5PbrqY0Iyv+TmVDnZ3yAyHO7797iwDLvKLWmKet2LYhdCj mLpFwifWp4sbWR46r2DD5pgT3j2dYjWjY3tHOzAnh9i0MdDcf9znqtZYsech70nkmS+A ZYyE8qRZsEyArHMFck8XgFxUDEjS5QEdDuVPWFdb0wkUpQhFerB2PcNKA5emUOEDlmHX wziQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=S5q5SWPfTa40+OAUuVF3swPwR1BfDxh1cBi++Y0wgbk=; b=gTw4YhbMProKckIw+lvwT5tMauZRLLIwwBN8syCXaog12N878Kk7tfCS8xpWeaeQn4 RbM5OepZOXOX1KiACkgtRFQ1Hy5oiGdiJ7M5iiaPbaIH+zuxqqhTHA9kO7QpksIsy8I1 PPCBLBnyGd7H2Th03G1lZysFuYrWjFNXECTbkdcSzdHL2pxm7eUxXslcSm837Yip1vTQ YuAo9YjRWyxwmfRY+NxfEs8y7j0sa8DLKIR0xI7vBjH30xKrVa9TFs4cf+EHzCaQCiMP dJnrMdrDTEEPFw4wEqolz4gcTshKLXCPGyeROL0o7m1ScYx3MYTOAuPzVmwLnPZf7rzz wTSw== X-Gm-Message-State: ACrzQf0k81o47ee2Nlo7NZiqe6PjzL+Fd+Lu9bSLl5NF+ebAE1uRHO+j WKV3ymS2x4m6zUbNXpgGdrGWeNeJk9qgseZtI+Da0C9Dbjg= X-Google-Smtp-Source: AMsMyM7r9xZEB7JMocWtTb1bIEr5EpH+zzVViAhOlFnYrohTe9fbudK98vl7VqgAGjC8o3z7AYfiM40/NaL5/r0cLOk= X-Received: by 2002:a17:90b:4b46:b0:202:7a55:5588 with SMTP id mi6-20020a17090b4b4600b002027a555588mr16478440pjb.55.1663538515621; Sun, 18 Sep 2022 15:01:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 19 Sep 2022 00:01:44 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000004b45f505e8fabe92" Subject: Re: [PHP-DEV] RFC: StreamWrapper Support for glob() From: timmy.almroth@gmail.com (Timmy Almroth) --0000000000004b45f505e8fabe92 Content-Type: text/plain; charset="UTF-8" Hi @Dan, hi @Sara. Thanks for giving us your feedback on this. > I think that although the RFC discussion can go ahead without a patch, > it would be better to have a patch before it went to vote, as there > seem to be quite a few hidden details that might not be able to be > made to work. I wanted that too. But it's hard to find someone willing to invest the time and effort. And it's even harder when that time invested is not guaranteed to lead to something. Therefore a PoC patch was produced that should give a good understanding of what is intended. It was not my choice but I understood the reasons. > but as noted in the PR (https://github.com/php/php-src/issues/9224), > where cmb69 wrote: > > > > In some cases it just makes no sense (e.g. compress.zlib:// and data://), in some > > cases it is impossible (e.g. http://), and in some cases it still might be > > impractical (e.g. ftp://). > > The exact details of edge cases probably need to be at least listed as > people (well at least myself) would view a lack of those details as a > reason to vote 'no', even if they thought the general idea was good. > > The RFC probably also needs to make an argument of why something that > sounds like it would be a leaky abstraction should be in core (and so > generating more support requests) rather than people using the already > existing userland package > (https://packagist.org/packages/webmozart/glob) which currently has > over 10million installs. I don't know what you mean by "a leaky abstraction". If someone is proposing we should raise awareness of file operations with compress.zlib://, data://, ftp://, or http:// then that should be a discussion for all filesystem functions and not only glob(). scandir() for one already supports streamwrappers and I have no idea why somone would attempt scandir('http://')? The current error handling in glob() is returning an empty array if it fails. I wouldn't find it odd if it also did that for glob('http://'). Regarding webmozart's workaround. I don't see third party libraries as a reason why we can't have nice things on the core level. Rather the opposite. They tell me the efforts that were needed just to cover for something that wasn't available on the core level. And the vast amount of people who came across this limitation. > There's a PR linked, but we should define the actual goals/APIs etc... in the RFC itself as well as the numerous edge cases I agree. If you wanna put it in writing I can put it in the RFC. For the edge cases my proposal is to return that empty array like it does for any invalid path today. We could leave a note or tip in the documentation, but again then you might need to do so with scandir() and all the other filesystem functions. @Sara let me know if you would like to take over this RFC? You are more experienced than I am. /Tim --0000000000004b45f505e8fabe92--