Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75296 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57051 invoked from network); 7 Jul 2014 00:53:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jul 2014 00:53:04 -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.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:38711] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/A1-41729-D6FE9B35 for ; Sun, 06 Jul 2014 20:53:02 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id CF5C22400C7 for ; Sun, 6 Jul 2014 20:52:58 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4lUStmLxahig for ; Sun, 6 Jul 2014 20:52:58 -0400 (EDT) Received: from andreas-air.home (host86-172-51-137.range86-172.btcentralplus.com [86.172.51.137]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 0CB6E24005D for ; Sun, 6 Jul 2014 20:52:57 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <9515FDBA-80C1-42F8-9C6B-3EFC3239F596@ajf.me> Date: Mon, 7 Jul 2014 01:52:51 +0100 Content-Transfer-Encoding: quoted-printable Message-ID: <26D88717-F093-465A-A2D8-428FE131D8B5@ajf.me> References: <9515FDBA-80C1-42F8-9C6B-3EFC3239F596@ajf.me> To: PHP Internals X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] [DRAFT][RFC] Big Integer Support From: ajf@ajf.me (Andrea Faulds) On 3 Jul 2014, at 18:29, Andrea Faulds wrote: > Either way, I think there should be some sort of warning (probably an = E_NOTICE > or E_WARNING?) when this cast happens implicitly and the number is = truncated, > such as in function calls. I=92m tempted to remove this from Open = Questions and > instead just Do The Right Thing and if someone objects later, the = patch and RFC > can always be changed. >=20 > Of course, it=92s worth noting we currently *don=92t* do any sort of = warning when > casting a float to a long causes a loss of information. Anthony = Ferrara=92s sadly > withdrawn RFC for scalar type hints would have done this for user land > functions, but that hasn=92t happened yet, so adding a warning here = would be > inconsistent with floats. The patch now raises an E_RECOVERABLE_ERROR if a bigint that is too = large is passed as an argument to a function expecting a long. I think = this is best as it would hopefully prevent bugs. I was inspired by = Anthony Ferrara=92s scalar type hinting RFC and Python=92s = OverflowErrors here. However, this does cause the previously mentioned issue that floats = don=92t do the same thing and simply truncate without warning here. = Should we change the behaviour for them as well? It would be = inconsistent not to. Should I make a separate RFC which would make = number casting behaviour strict and then make the bigint patch and RFC = consistent with it, on the hope that separate RFC could be passed first? = That way this wouldn=92t become an issue that might block the bigint = RFC. -- Andrea Faulds http://ajf.me/