Missing warning for stat(), etc. when invoked with empty string

From: Date: Thu, 03 Dec 2020 13:30:15 +0000
Subject: Missing warning for stat(), etc. when invoked with empty string
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-112397@lists.php.net to get a copy of this message
[Of course, I meant stat(), not stats(). Resending the message with correct spelling, including in subject line. Sorry.] Hi, stat() and friends invoked with empty string or null as argument, return false (indicating failure), but do not emit the Warning that is expected on failure. See: https://3v4l.org/jXC2N <https://3v4l.org/jXC2N> That discrepancy between the two ways of indicating failure is problematic. 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 in case of stat()), or run the panic procedure of my error handler. I propose to ensure that those functions always emit a Warning in each and 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 for failure condition as in file_exists()). —Claude

« previous php.internals (#112397) next »