Hello,
IMHO it’s only a declaration issue. 

In other terms, if documentation of strlen says:

strlen ( string $string ) : int

then I mean that $string MUST be a string, and return value MUST be an int.

But then we found that if $string is null, zero is returned. If $string is an 
array, null is returned …
We simply need consistency between how a function is documented, and how it 
really works.
I mean, it may also be convenient for strlen to accept a parameter type other 
than string (such as null), but it must be well documented.


Da: Josh Bruce
Inviato: martedì 1 dicembre 2020 22:21
A: Nikita Popov
Cc: PHP internals
Oggetto: Re: [PHP-DEV] [RFC] Deprecate passing null to non-nullable argumentsof 
internal functions




Reply via email to