Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112409 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47157 invoked from network); 4 Dec 2020 12:24:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Dec 2020 12:24:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9D941180511 for ; Fri, 4 Dec 2020 03:52:15 -0800 (PST) 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 4 Dec 2020 03:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607082732; bh=cWZpUtoglM7jdvBU4sXSAWax/aMCEmEPhf+RQrQTMLE=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=d+APqQgY3ZGU/KVrMcCUqyx8ipp0Fy5QjTJ6FX9bQVaIhPUXwDuloYi8Co9FNdp+3 SQ2iM8wNx/U1Drm6dM75/Rjy94xaRInT92d7vWM8+aGBjV+K3yFzQKpKZn0mLU5sel TG+ScXtLn8EORGPyl9LRCummSPdWPp+gXIO5Fueg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([79.222.40.233]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MMXQ5-1kUS5r1UFr-00JcNe; Fri, 04 Dec 2020 12:52:12 +0100 To: Claude Pache , PHP Internals References: <34FA3E20-9D06-4D08-937E-4216FEF35504@gmail.com> Message-ID: Date: Fri, 4 Dec 2020 12:52:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <34FA3E20-9D06-4D08-937E-4216FEF35504@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:CMq9CXxls33zGWo1hWFL0IE7HIw50yxuMfsiBxM0lNZDqqZ0+UF ifU+wI67UEvx7hwHeABy0eH+YBTJRZoJoFDsD1axoPwLjNGZw2Wg7G/78AhAYCzUBkMgl6n yZ+64AlBPs5o6Gbzc5GRK/h1g+6FO2o0v0WxydV2oz6uQhpsNmUViP6jPisHzsyJjjzz4lr DatKIbxMVVUZEts5uWeKw== X-UI-Out-Filterresults: notjunk:1;V03:K0:8YW9P2zNKZA=:yqb8YOZueNxZzm9ER1slXF mFW5TECFoxFtt1xORmxwZvMBGXUKw6aHlolsZMZFZWKjrvbRaJCeuAhpThOt4oNvXz0/usp8A 1MJnro56sgKHxZ8OYaWUoMy1NWd1kblP+vbtEJoqvbiUyMhOVENFWhMTNtZEei25Y/4OomQdW fqGPCUViUq7Y3GpGAtvQZSb9PX0Q48sRcyYpKw8Tab3Icu4KgwBOXDW+Bo3EkIu6yn+M2cxOj m1sAaBufbCNWTnc2yC3KmT1u+H7PO8DicDXQv4CAChEqCihWqj/EX2mQjPubdiTJQGbbIeI/G 8J2SygkVhuqOWnThcMlMvWcq3Mfn9u5d3nbcFXAKfmOyOYqgURKr9iIZOF/zy60cNZtKWjmvH 54vpLDo1JcFXVN8kZzvvV5lgu00JjA0Q0NB6GvU1+PQJH+jNXRCa0TJr4NWv76PZz+mra6czt MuUZVVUguKN3NitaApXarujdU6I5nd+dRLCjpUOj8jQhv8FKpLSs60Rz4Z9pnPyi0Dve6ra24 RL0JMVomf4U4WNRbjDHzM6q+VWFhi7N0dl2KA42pTXM0O4dYLXAvefjtE7DghBjSNDZrFcNZ8 cpQbErvTbz0k2EfPWvOS3Y0sBJg6oTr1biRzOa2lyNsKgM6eoi1UY+p4Q9tON8N9SCbFQrjmM aKFq4Z2chsGFVKPyi47cMyWDk4tBgeHIF94UumNmHiH3k062ww1awYD0WtSXTLsbz/v4IPodY Tlr7hnR14E3AzUOnkWzO/ACY/xegFjKmMJHm2ar4JJkBBLUbOtGQh7vLYYCD5zGrxebc8hvcS fJd2IYfj7yrHZ6WpzbdMs2wHV3j3yfZ8tC1YKymUVkPRQF6xEZi7T0mOxbBkVAhkwcxbIKlBf FMaIsdVo5qT/eVa/4jcQ== Subject: Re: Missing warning for stats(), etc. when invoked with empty string From: cmbecker69@gmx.de ("Christoph M. Becker") On 03.12.2020 at 11:20, Claude Pache wrote: > `stats()` and friends invoked with empty string or null as argument, ret= urn `false` (indicating failure), but do not emit the Warning that is expe= cted on failure. See: https://3v4l.org/jXC2N > > That discrepancy between the two ways of indicating failure is problemat= ic. Indeed, whenever I use one of those functions without prefixing it by = @, I expect that it will either return a value of expected type (`array` i= n case of `stats()`), or run the panic procedure of my error handler. > > I propose to ensure that those functions always emit a Warning in each a= nd every situation they return false/null (provided, of course, that those= functions are not supposed to return `false/null` in absence of failure, = and that their purpose is not to check failure condition as in `file_exist= s()`). Returning false without raising a warning has been introduced[1] to fix bug #21410[2]. The problem back then was that without that early return, on Windows the empty string gave erroneous stat() results, and filetype("") returned "dir". This is no longer the case at least as of PHP 7.3.0 (I didn't test older versions); instead after reverting 560e33968d I now get: Warning: stat(): stat failed for in %s on line %d bool(false) So, yes, I think we should revert that commit. [1] [2] Regards, Christoph