Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6691 invoked from network); 14 Jul 2014 15:21:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 15:21:48 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:51599] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/33-25444-B85F3C35 for ; Mon, 14 Jul 2014 11:21:48 -0400 Received: by mail-vc0-f171.google.com with SMTP id id10so7514159vcb.16 for ; Mon, 14 Jul 2014 08:21:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=ru5cBPp5NyVec9e/4UYWIQ0Odz294hjxtTr31Rmkxx0=; b=PGQSLN3drz6OIm8L+O7LCGOiSDxhyOFrSBCdx+Rpc7OeQjU5d9rGvkINphEMUi4EFQ Kr3SbKlFqBCHZDEQJg6AFoYCyz0Mkc628oeFOFJmLT+xCHdtQ0k5a094SO3AiEqMUUrm guLvqOrpR/ivsnBYKCIE5ntm2d50yBQmn9nl9ilt6BvIhWTtXVp8OI97PLxLVBz8B/6Q fltUQfOHnPJ/QjTa4bdwwcycDnikXoAz989Dmi15fPpVR9xeSwB6//L5tp340ws6t0YL otIwaZrv1t29yqGW/woX9/QPWZKMMcUUz4dMo2BDhao1XdixdAslLT/cC1W2os/Mxtby jf/g== X-Gm-Message-State: ALoCoQmYDVmV42K6ej04wO7yaEz3Myh7W7cxtppsGqgzfmZV0/SEA9HJbe8OOyvXUpKvvj2/kSUYuDNVK6nQfAAJVGK3uzmRS+VnRywUXwDNnKME3XRY8dwf1n89NdKRrotkMwi4m92+ X-Received: by 10.52.253.140 with SMTP id aa12mr14121834vdd.11.1405351304860; Mon, 14 Jul 2014 08:21:44 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <6C08D5C1-7A37-4F49-BF12-96B614B4B50B@ajf.me> <8c4fa132c69f0e72d1fd963461a110c6@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwHleMkPAd/qfJcBzHP03AINxCkwAt+f6PkCKPEQC5n9DAeQ Date: Mon, 14 Jul 2014 18:21:44 +0300 Message-ID: <01fb65fe115be4ce14cad68d3d0ad2c0@mail.gmail.com> To: Andrea Faulds Cc: Derick Rethans , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Monday, July 14, 2014 6:12 PM > To: Zeev Suraski > Cc: Derick Rethans; PHP internals > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > On 14 Jul 2014, at 16:07, Zeev Suraski 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. Perhaps (I think it's more difficult than you think but perhaps I'm missing something); Either way, it's the wrong way to do it IMHO regardless. Having this as either a notice or a special E_CAST has no meaningful drawbacks, only advantages, and will also enable us to implement these warnings in regular casts for even greater consistency (a recoverable error is out of the question for those, of course, as it's a huge BC break). Zeev