doc-en icon indicating copy to clipboard operation
doc-en copied to clipboard

FILTER_VALIDATE_BOOL: make it clearer than `null` is treated as an empty string

Open DanielEScherzer opened this issue 1 year ago • 4 comments

Ref php/doc-en#3801

DanielEScherzer avatar Sep 26 '24 03:09 DanielEScherzer

Thank you for the PR! However, I'm not sure how to document this. Note that null is just a special case; a stringable object would also be accepted (https://3v4l.org/jFgDD). But even FILTER_VALIDATE_BOOL is only a special case; it seems to me that FILTER_REQUIRE_SCALAR is generally a mis-nomer, and badly documented: "Requires the value to be scalar.", while in practice it is fine with most non scalar values, too (e.g. https://3v4l.org/8ZVMA).

cmb69 avatar Sep 26 '24 11:09 cmb69

Thank you for the PR! However, I'm not sure how to document this.

I wasn't sure either, but figured a patch was better than the php-src report just sitting there

DanielEScherzer avatar Sep 26 '24 12:09 DanielEScherzer

Perhaps it should say that all values are converted to string

kamil-tekiela avatar Oct 05 '24 19:10 kamil-tekiela

This PR needs to be reworked, I agree that saying any value being checked is going to be cast to string is better.

Girgias avatar Nov 08 '24 08:11 Girgias