Re: PHP 8 is_file/is_dir input handling
| From: | Mike Schinkel | Date: | Wed, 09 Dec 2020 17:58:11 +0000 |
| Subject: | Re: PHP 8 is_file/is_dir input handling | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112474@lists.php.net to get a copy of this message | ||
> On Dec 8, 2020, at 11:27 AM, Christian Schneider <cschneid@cschneid.com> wrote:
>
> Am 08.12.2020 um 17:16 schrieb Mike Schinkel <mike@newclarity.net <G
> ç•òì¹Ô¾Øz<T.xmailto:mike@newclarity.net>>:
>> 1. Please consider making is_file() return false for an embedded \0 and no longer throw an
>> exception or generate a warning.
>
> The PR implementing this has already been merged for inclusion in PHP 8.0.1:
> https://github.com/php/php-src/pull/6478
> <https://github.com/php/php-src/pull/6478>
Thanks.
>
>> 2. Beyond is_file(), please consider allowing PHP to support both types of error handling
>> strategies without forcing complexity just to use the 2nd strategy.
>
>
> This is a contentious topic
Exactly.
> and will have to be handled on a case by case basis I guess.
Which is really all I was asking for; that it be considered on a case-by-case basis instead of just
assuming that exceptions are always preferable.
> E.g. for security-related stuff a fail-early-strategy throwing an exception might be
> preferable, for basic lower-level functions like is_file() returning false was chosen to be
> preferable.
> There is no silver bullet for all cases and having a global switch would only make things
> worse.
-Mike