On 03/12/2020 06:52, Stanislav Malyshev wrote:
PHP functions always returned null on bad parameters, so it's not
exactly unexpected.
and
On 02/12/2020 23:49, Christoph M. Becker wrote:
Just to reiterate, the former behavior was documented[1], and the return
value was*undefined*. Instead of returning NULL, the erroneous
function call could have returned anything, even TRUE. Relying on
undefined behavior is bad.
The note on https://www.php.net/manual/en/functions.internal.php says:
> If the parameters given to a function are not what it expects...
But the prototype on https://www.php.net/manual/en/function.is-file.php is:
is_file ( string $filename ) : bool
And the description says only:
filename: Path to the file.
While it's clear that passing e.g. an array falls into the scope of that
general note, it doesn't say anywhere on that page that a string value
which contains "\0" is "not what it expects", and I don't think I would
ever have guessed that before reading this thread.
So I stand by my assertion that this behaviour was both undocumented and
unexpected.
Regards,
--
Rowan Tommins (né Collins)
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php