Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75617 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67601 invoked from network); 16 Jul 2014 23:37:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2014 23:37:33 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:49256] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/A5-37298-DBC07C35 for ; Wed, 16 Jul 2014 19:37:33 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 727C0B00087; Wed, 16 Jul 2014 19:37:30 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id p_ljm-XEEgmT; Wed, 16 Jul 2014 19:37:30 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id D8AB2B0007B; Wed, 16 Jul 2014 19:37:27 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <53C70983.7040400@sugarcrm.com> Date: Thu, 17 Jul 2014 00:37:24 +0100 Cc: Zeev Suraski , Andrey Andreev , Rowan Collins , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <16D48604-0C0A-4613-91A4-21392E3A2636@ajf.me> <05CE2216-C5D9-4937-9F2E-AA1407284D9F@ajf.me> <53C460DF.5040304@sugarcrm.com> <53C53A96.2040303@gmail.com> <53C55342.1010207@sugarcrm.com> <53C563B3.6060905@gmail.com> <54536191-1B92-4933-973F-0C8289D13A4C@ajf.me> <00d12255efc53466245b21a83ff7d474@mail.gmail.com> <1CE2ACC0-D6CA-407B-99C7-4914311B733E@ajf.me> <53C6CFB7.8090908@sugarcrm.com> <118BB3D7-BE52-44AB-BD0E-942830D44A2A@ajf.me> <9B7B8559-61FE-493D-BAEE-53E8C84D5E91@ajf.me> <221d3e5c1be1ee2277e05027912762db@mail.gmail.com> <53C70983.7040400@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: ajf@ajf.me (Andrea Faulds) On 17 Jul 2014, at 00:23, Stas Malyshev wrote: > I think this is not correct. It can be OK in one context and error in > another. I.e., if you say "let's ask users how many gizmos they want" > and the user gives "1 " (note the space) and we tell them "we don't = know > what this even means, there's an extra character there" - doing this > would just annoy the user. Silently converting it to 1 would do the > right thing. >=20 > If you say making any distinction between "1" and "1 " is useless for > you - well, I can accept that. I can see use cases where it makes = sense > to make distinction but they are a minority. I think there's a level > between E_RECOVERABLE_ERROR and silence where it's not "I can't make = any > sense out of this garbage" but also not "it's clean data". But I can > also live without this level, if that is what the majority comes to. = In > that case, I'd rather have "1 " converted to 1 silently. There are really only two levels of error IMO, those that are log file = messages (silenced or no), and those that actually stop the script = unless handled. I worry about making E_CAST the former but allowing = people to make it the latter, because then people would and suddenly = code relying on it being the former would make your app stop working. -- Andrea Faulds http://ajf.me/