Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76012 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12323 invoked from network); 24 Jul 2014 14:26:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2014 14:26:57 -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:47414] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/C9-58899-0B711D35 for ; Thu, 24 Jul 2014 10:26:56 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 4D8AAB00085; Thu, 24 Jul 2014 10:26:57 -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 EKrDaRrA02Qj; Thu, 24 Jul 2014 10:26:57 -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 3C0DAB0007B; Thu, 24 Jul 2014 10:26:52 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 24 Jul 2014 15:26:50 +0100 Cc: Zeev Suraski , Stas Malyshev , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <12448510.rPWIJSKt4t@rofl> <53D0CBE2.5010200@sugarcrm.com> <33bf22776118d2b4ddafee7014a826b2@mail.gmail.com> To: Simon Schick 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 24 Jul 2014, at 13:20, Simon Schick wrote: >> Conversion is allowed only if data-loss does not happen. There are a = few exceptions (objects using __toString, strings containing leading = numerics, etc). Here's a table of examples. >=20 > But if you look at the table, strings containing leading numbers are > not allowed. Good catch, fixed. > And just as a thought: What about objects where the __toString method > returns a string like "42"? Would that also be accepted as an > argument, that just accepts integers? No it wouldn=92t, as that=92s not what cast_object does, existing = conversion functions do, or what the patch does at present. -- Andrea Faulds http://ajf.me/