Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75403 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43264 invoked from network); 13 Jul 2014 14:31:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2014 14:31:44 -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.169 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.169 mail-vc0-f169.google.com Received: from [209.85.220.169] ([209.85.220.169:35126] helo=mail-vc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/E4-16748-F4892C35 for ; Sun, 13 Jul 2014 10:31:44 -0400 Received: by mail-vc0-f169.google.com with SMTP id hu12so343090vcb.28 for ; Sun, 13 Jul 2014 07:31:41 -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=6IUYDnXDYLka4r4yrs2razgLsRZjEpcohnuTbBGDum8=; b=G+QrKE8aKrrQg4pRV1lW/7N6jWQ4BwOAd7k+5YYYJXGINoKkGjWd4zr0TnvCxTsnH4 w0Gm8W0hoOCI4R3n4ckt8OejyaUt7Mj3RsSLY2q/KPfqCsIps10EILBrc/1qqfz4rppg yW8LdyJ7KwvJ7hJfGzintEFMs7dzTkE/Ob5iO3umK+0iMltp4O1guB9iCCXWlgyIAXY6 IJTH8i/NJIUVYgEGNsI3HfcT/m1huO9Ii64Ts2898Ar5xQPe16lM+SsdQLd95KtrwsV6 WkQzIb79LVsYaVfLVUXPt0oxrJH+jCFWhBLqY5itlo6Db9sWrMxCKUlPdNGEZktrRF6C KIjw== X-Gm-Message-State: ALoCoQkl1be6nzJ52NxFfAMLI/v43jeJy8gW11EyrxRqriuPoXfHIjhNMlJC20LT/8KvONPRMDqMKLzD4/rZqBjzuR9kFcmtwHkcXZnl/7iFoZLzGATYCA33gWs1zvpKrKglZ1NE709k X-Received: by 10.58.2.201 with SMTP id 9mr55233vew.58.1405261901743; Sun, 13 Jul 2014 07:31:41 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <027E65EF-C4FC-474C-92BB-D99EFADDEEED@ajf.me> In-Reply-To: <027E65EF-C4FC-474C-92BB-D99EFADDEEED@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwOWY2SKAql1dl6aLq6DYA== Date: Sun, 13 Jul 2014 17:31:41 +0300 Message-ID: To: Andrea Faulds , Nikita Popov Cc: 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) I think this is a big step in the wrong direction to one of the most common auto-conversion use cases out there (HTTP input variables). See my note to Nikita... This RFC is a huge deal, I suggest we let more people voice their opinion in before changing it in each direction :) Zeev > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Sunday, July 13, 2014 5:21 PM > To: Nikita Popov > Cc: PHP internals > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > On 13 Jul 2014, at 13:09, Nikita Popov wrote: > > > I haven't yet closely reviewed the details of what is and isn't > > allowed, but one things I would strongly recommend against is > > introducing any "accept but throw a notice" cases. Either a value is allowed > or it isn't. > > "12foo" to an int/float argument should throw a recoverable fatal > > error, like everything else. (I'd change that in zpp as well, but > > that's a different discussion). > > I've changed this case in the RFC and my patch. Previously, "12foo" would just > throw an E_NOTICE, but now it is not accepted: > > Integer hints: > > function foo(int $a) { > var_dump($a); > } > foo(1); // int(1) > foo("1"); // int(1) > foo(1.0); // int(1) > foo("1a"); // E_RECOVERABLE_ERROR > foo("a"); // E_RECOVERABLE_ERROR > foo(999999999999999999999999999999999999); // > E_RECOVERABLE_ERROR (since it's not exactly representable by an int) > foo(1.5); // E_RECOVERABLE_ERROR > > Float hints: > > function foo(float $a) { > var_dump($a); > } > foo(1); // float(1) > foo("1"); // float(1) > foo(1.0); // float(1) > foo("1a"); // E_RECOVERABLE_ERROR > foo("a"); // E_RECOVERABLE_ERROR > foo(1.5); // float(1.5) > > -- > Andrea Faulds > http://ajf.me/ > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: > http://www.php.net/unsub.php