Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters
| From: | Nikita Popov | Date: | Fri, 09 Mar 2012 07:51:51 +0000 |
| Subject: | Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-58807@lists.php.net to get a copy of this message | ||
On Fri, Mar 9, 2012 at 3:58 AM, Ilia Alshanetsky <ilia@prohost.org> wrote:
> Anthony,
>
> My concern with this type of patch is that what you are proposing are
> not really hints, they are forced casts. As such they modify the data
> potentially leading to data loss.
This patch specifically tries to overcome this problem of the previous
version. It will not accept input which will lead to a data loss on
cast. The only exception is passing "123abc" to an int hint, which
will cast to 123 and throw a notice. This is also my only point of
critique: I'd prefer to be stricter here and go all the way to a
recoverable fatal error.
Nikita