Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58885 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19094 invoked from network); 12 Mar 2012 19:41:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2012 19:41:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:2575] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/11-13375-5815E5F4 for ; Mon, 12 Mar 2012 14:41:58 -0500 Received: (qmail 833 invoked by uid 98); 12 Mar 2012 19:41:59 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.037185 secs); 12 Mar 2012 19:41:59 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 12 Mar 2012 19:41:58 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 12 Mar 2012 14:41:59 -0500 Message-ID: In-Reply-To: References: Date: Mon, 12 Mar 2012 14:41:59 -0500 To: internals@lists.php.net User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters From: ceo@l-i-e.com ("Richard Lynch") On Fri, March 9, 2012 2:51 am, Nikita Popov wrote: > On Fri, Mar 9, 2012 at 3:58 AM, Ilia Alshanetsky > wrote: >> Anthony, >> >> My concern with this type of patch is that what you are proposing >> are >> not really hints, they are forced casts. As such they modify the >> data >> potentially leading to data loss. > This patch specifically tries to overcome this problem of the previous > version. It will not accept input which will lead to a data loss on > cast. The only exception is passing "123abc" to an int hint, which > will cast to 123 and throw a notice. This is also my only point of > critique: I'd prefer to be stricter here and go all the way to a > recoverable fatal error. So what happens to (int) "1233553463645747675685685" Does it cast and then cause an overflow, which PHP pretty much ignores and wraps to a negative number? Or does it error out as you can't convert without mangling the data? Will it behave differently on 32-bit versus 64-bit hardware for values that are in-range of 64 but no 32? -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE