Re: Missing warning for stat(), etc. when invoked with empty string
| From: | Christian Schneider | Date: | Fri, 04 Dec 2020 07:12:31 +0000 |
| Subject: | Re: Missing warning for stat(), etc. when invoked with empty string | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112403@lists.php.net to get a copy of this message | ||
Am 03.12.2020 um 22:13 schrieb Nikita Popov <nikita.ppv@gmail.com>:
> On Thu, Dec 3, 2020 at 10:06 PM Levi Morrison via internals <
> internals@lists.php.net
> <mailto:internals@lists.php.net>> wrote:
>> This is a long-standing behavior. Further, I don't know many people
>> who want _more_ warnings in their codebase.
>>
>> In other words, I disagree with this proposal.
>
>
> This seems like a pretty odd position to take. I think there's two ways it
> can reasonably behave:
>
> 1. Always generate a warning if stat() fails.
> 2. Never generate a warning if stat() fails.
>
> While the current option is:
>
> 3. Always generate a warning if stat() fails ... unless an empty string was
> passed.
>
> I'm okay with either 1. or 2., but I don't think that 3. constitutes
> sensible behavior.
Wel,, there is actually a third case: null (which is also the reason for the empty string behavior)
Some people might use it like "I have a filename but there is no such file, so stat() should
issue a warning because something unexpected happened" and "I have no filename so the
warning is not necessary".
So 3 might not be completely useless. That being said: I'm not against changing 3 to 1, I just
wanted to point out the null-case.
- Chris