On Tuesday, Dec 1, 2026 at 08:35 Robert Chapin wrote:
> I enjoyed reading this RFC because it was so much better than the recent
> deprecate-fuzzy-casts RFC.
>
> My only critique is that this RFC must mention the php.ini treatment of
> bools, and whether or not that would be changed. The concern here:
> Very near the top of php.ini-production, we have a pattern of setting
> the bools display_startup_errors, log_errors, etc, using INI literals On
> and Off.
>
> https://github.com/php/php-src/blob/82ec0c066ca6d6d60713e0c7aedc24af56f879d6/php.ini-production#L102
>
> https://www.php.net/manual/en/errorfunc.configuration.php#ini.display-startup-errors
>
> If this is not directly relevant to the RFC, that still should be
> clearly stated in the RFC, perhaps even with a brief discussion of the
> ini_get() behavior.
>
> Thank you for your efforts!
Hi Robert,
Thank you for bringing this up.
The way PHP reads INI settings isn't affected by the RFC. The INI parser stores
`On`/`Off` (as well as `yes`/`no` and `true`/`false`) as the strings '1' and
'', and boolean settings like `display_startup_errors` and `log_errors` are
read from those strings without going through a type declaration, so php.ini
files using `On` and `Off` keep working exactly as before. `ini_set()` declares
`$value` as `string|int|float|bool|null`, so passing a `bool` to it isn't
deprecated either.
The one change is for code which passes `ini_get()` values directly to a `bool`
parameter. `ini_get()` returns the stored string unchanged: '1' for a setting
set to `On` or 1, '0' for 0, and '' for `Off`, so the '' would get a
deprecation, as with any empty string. But `ini_get()` values already need
explicit parsing: after `ini_set('display_errors', 'Off')`, `ini_get()` returns
the literal 'Off', which `(bool)` turns into `true`, even though PHP itself
treats the setting as disabled. Since 'Off' passed to a `bool` parameter would
also emit a deprecation, the RFC helps catch places where boolean INI settings
aren't properly parsed. `filter_var($value, FILTER_VALIDATE_BOOL)` handles all
of these correctly.
I've added a note about this to the "Unaffected PHP functionality" section of
the RFC.
Thanks,
Theodore