Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Andrea Faulds | Date: | Mon, 14 Jul 2014 15:11:59 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75472@lists.php.net to get a copy of this message | ||
On 14 Jul 2014, at 16:07, Zeev Suraski <zeev@zend.com> 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.
--
Andrea Faulds
http://ajf.me/