On Wed, Jun 4, 2025, at 11:16 AM, Theodore Brown wrote: > On Wed, June 4, 2025 at 09:37 Aleksander Machniak wrote: > >> On 4.06.2025 16:03, G. P. Banyard wrote: >>> I don't understand what you mean. >>> The purpose is to deprecate the behaviour in 8.5 so that it can be removed >>> in PHP 9. >>> We try to not break behaviour with no prior warning. >>> Could you clarify what you mean? >> >> I meant to move the deprecation to PHP 9.0. I feel the impact of >> deprecation itself in this case might be significant. > > You feel there might be a lot of code passing floats, ints, or strings to > `bool` parameters? I'm doubtful this is the case, since static analysis tools > and IDEs are in much more widespread use nowadays. > > In my experience passing non-boolean values to a `bool` parameter almost > always > indicates a bug, and it would be valuable to get a deprecation notice sooner > rather than later so these mistakes can be fixed. > > Regards, > Theodore
The one place I can see it being used now legitimately is MySQL's TINYINT pseudo-bool columns. If you're mapping your query results into an object (please always do this), then you probably want to cast that into to a bool, and currently weak mode would let you do that implicitly. I can't think of a case where a string or float magically casting to a bool is reasonable. --Larry Garfield