When strict_types is off, PHP converts values to fit a declared type. Pass 1 to a bool parameter and it becomes true, or pass false to an int parameter and it becomes 0. This is called type juggling. This RFC from Gina Peter Banyard would have deprecated juggling to and from bool for function arguments, return values and typed properties. It was declined.
Why change it
The RFC argues that these conversions usually hide bugs. Many PHP functions return false when they fail, and if that false quietly becomes 0 or "", the failure goes unnoticed. The author found bugs like this in PHP's own test suite while building the patch.
Converting to bool has its own surprises:
- The strings
""and"0"becomefalse, but"false"and" "becometrue. - Only
0.0and-0.0becomefalse, whileNANbecomestrue.
The RFC also names some longer-term goals. It would make true|false mean the same thing as bool, and it would clear a path toward someday merging PHP's two typing modes, strict and weak.
What it would look like
Passing true or false to any of these functions would emit a deprecation notice:
function example1(?int $v) {} function example2(?string $v) {} function example4(int|string $v) {} function example7(int|float|string $v) {}
The same would apply in the other direction. Passing an int, float or string to a bool parameter would be deprecated, and you'd need an explicit (bool) cast instead.
The RFC only covers this "function" type juggling context. Conditions in if, operators like &&, echo, arithmetic, comparisons and array keys would all keep working as they do now.
What it means for existing code
Nothing changes, since the RFC was declined. Had it passed, files using strict_types=1 would mostly have been unaffected, except for callbacks that PHP calls for you. Files without it would have seen deprecation notices in PHP 8.5, with the conversions removed in PHP 9.0.
The vote
It failed with 10 votes in favor and 11 against, far from the two-thirds majority it needed. Voting closed on August 4, 2025.