Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Lester Caine | Date: | Mon, 14 Jul 2014 15:39:19 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75476@lists.php.net to get a copy of this message | ||
On 14/07/14 16:11, Andrea Faulds wrote:
>> It does, as it creates an error (recoverable or not), and it doesn't allow
>> > "13abc" to easily turn into 13 (int), even if you implement an error
>> > handler that ignores E_RECOVERABLE_ERROR.
> Actually, you’re right. In the current patch, if you run this:
>
> set_error_handler(function () { return true; });
> function foo(int $a) { var_dump($a); }
> foo(“13abc”);
>
> You would get this:
>
> int(0)
>
> However, that could easily be fixed so the error case uses the normal casting behaviour.
The irritating thing here is HAVING to add the error_handler which may
well have been installed already for other reasons ... possibly in some
third party library to compensate for other changes?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk