On Wed, 13 Apr 2022 at 20:08, Andreas Leathley <a.leath...@gmx.net> wrote:

> Mentioning the documentation as a reason to be "consistent" (which comes
> up again and again in your arguments with this RFC) just seems like a
> bogus reason to me. It is nitpicking about specific sentences in the
> documentation without refering to the surrounding context. It would be
> nicer to argue according to real technical arguments instead of
> arguments about sentences taken out of context in the documentation.
>


I don't, do I?

I've checked multiple times, and I only use the documentation to note how
NULL coercion works. I'm using the word "consistent" to be "consistent with
scalar types"... as in, a string/int/float/bool can be coerced, but NULL
coercion has now been deprecated in some cases, as shown with the examples.




> "Most developers do not share that view". I find statements such as
> these as a tall order - did you interview the majority of developers
> around the world? Are you suggesting you are talking as a representative
> of a large population of PHP developers? How do you think you got such a
> role?



My intro says "Roughly 85% scripts do not use strict_types=1", and "Roughly
33% of developers use static analysis" (source of numbers noted in my
RFC)... while that does not guarantee anything, it's a fairly good
indication that most developers do not care about types (in regards to
coercion), or specifically, how you "see null as a real type".

As an aside, I would like to include more stats (maybe WordPress install
numbers?), but I couldn't think of any which were easy to source (ref
reliability), or be that useful to the discussion.



I would prefer some humility and not assume you are an elected
> leader of an underrepresented group of developers and even knowing the
> intention behind their code.
>


I'm simply describing the situation, and I have suggested two ways to avoid
the upgrade problems (the suggestion to update some arguments to be
nullable has been rejected by written feedback, and via my questionnaire).



"NULL has been passed to these functions, since, well, forever" - this
> also goes for wrong values being passed to functions since forever
> leading to security issues and bugs.



I say in the RFC that "Arrays, Resources, and Objects (without
__toString()) cannot be coerced (for fairly obvious reasons)".

For example `htmlspecialchars(array())` will, as of 8.0, throw a Type Error
(and a warning before), that does represent a bug (it should not happen),
and I'm very happy with that situation. But NULL coercion is different, it
has worked well for years, and it is used a lot (see the examples in my
RFC).

Craig

Reply via email to