Re: PHP 8 is_file/is_dir input handling
| From: | Christian Schneider | Date: | Tue, 08 Dec 2020 16:27:35 +0000 |
| Subject: | Re: PHP 8 is_file/is_dir input handling | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112468@lists.php.net to get a copy of this message | ||
Am 08.12.2020 um 17:16 schrieb Mike Schinkel <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
> 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 and will have to be handled on a case by case basis I guess.
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.
- Chris