Re: [RFC] Safe Casting Functions
| From: | Dmitry Stogov | Date: | Tue, 21 Oct 2014 09:14:49 +0000 |
| Subject: | Re: [RFC] Safe Casting Functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78185@lists.php.net to get a copy of this message | ||
Both, the idea and implementation look fine.
Personally, I hate the existing type conversion rules, and I would like to
use something like this by default (may be with exception for
null/false/true handling), but it may be a big compatibility break, so
introducing to_int() is better than nothing.
some notes:
- it's probably make sense to implement these function as a new opcode(s)
in VM
- in case of conversion failure it's better to throw exception (to_int()
returning FALSE is a pain).
Thanks. Dmitry.
On Tue, Oct 21, 2014 at 2:57 AM, Andrea Faulds <ajf@ajf.me> wrote:
> Good evening,
>
> 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.
>
> Thanks!
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>