Re: [RFC] Safe Casting Functions
| From: | Stas Malyshev | Date: | Tue, 21 Oct 2014 00:32:46 +0000 |
| Subject: | Re: [RFC] Safe Casting Functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78165@lists.php.net to get a copy of this message | ||
Hi!
> I am presenting a new RFC to add a set of three functions to do validated casts for scalar
> types:
>
> https://wiki.php.net/rfc/safe_cast
>
> Please read it.
The main problem that happened with scalar typing RFC remains here:
third set of rules for casting types. Of course, since it's "just"
functions and not language constructs, we can have a set of functions
for any set of casting rules anybody wants. But I think it's still the
same problem here - having three sets of casting rules is not good.
Wait, we actually already have FILTER_VALIDATE_INT and
FILTER_VALIDATE_FLOAT, so that would be the fourth set of rules, and the
second set of validation rules, despite already having an extension
specially dedicated to filtering and validation. I think we should not
multiply entities needlessly - if we need some different validation
primitives, why not add them to filter, for example?
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/