Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75616 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66189 invoked from network); 16 Jul 2014 23:35:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2014 23:35:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:47854] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/55-37298-24C07C35 for ; Wed, 16 Jul 2014 19:35:30 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 207278C0080; Wed, 16 Jul 2014 19:35:28 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Mlm2q3ih37Cj; Wed, 16 Jul 2014 19:35:27 -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 0F97E8C0075; Wed, 16 Jul 2014 19:35:26 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <53C70843.9080801@gmail.com> Date: Thu, 17 Jul 2014 00:35:23 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <41CD10AE-21DC-4863-976C-6AD6A4D02A3C@ajf.me> 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> <0476c27fc2a44f715ed50052e47a3b1a@mail.gmail.com> <9141893E-2DC7-437D-A684-CA5ACA2F7D33@ajf.me> <53C70843.9080801@gmail.com> To: Rowan Collins 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:18, Rowan Collins wrote: > Now, I have no idea how ZPP actually works, and get lost in a maze of = macros whenever I try to look at it, but evidently it has logic to = distinguish, at least for string->int, three cases: >=20 > 1) safe / lossless / well formed input (cast silently), e.g. '123' =3D> = int(123) > 2) unsafe / lossy / non well formed (give a notice), 'e.g. '123abc' =3D>= int(123) > 3) impossible / inappropriate (from the point of view of the user, = give a warning, and cause different behaviour of the function), e.g. = 'abc' =3D> int zpp=92s casts are (one form of) implicit cast. We actually do multiple = different kinds of implicit casts in different places with different = results; =930xa=94 is variously an integer and not an integer, depending = on context, because nobody seems to have made their mind up whether = is_numeric_string or strtol is used to parse numeric strings. :( The only casts that are explicit are using (int) and friends, or = intval() and friends (I believe the two are equivalent). -- Andrea Faulds http://ajf.me/