Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86992 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94478 invoked from network); 2 Jul 2015 00:31:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2015 00:31:35 -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:54674] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/D2-20693-46684955 for ; Wed, 01 Jul 2015 20:31:33 -0400 Received: from localhost (localhost [127.0.0.1]) by imap2.ox.privateemail.com (Postfix) with ESMTP id 0630D8C0081; Wed, 1 Jul 2015 20:31:29 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from imap2.ox.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hmIX3XzQ_-dD; Wed, 1 Jul 2015 20:31:28 -0400 (EDT) Received: from [192.168.0.3] (unknown [90.211.5.114]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by imap2.ox.privateemail.com (Postfix) with ESMTPSA id 97E808C0083; Wed, 1 Jul 2015 20:31:25 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) In-Reply-To: Date: Thu, 2 Jul 2015 01:30:50 +0100 Cc: Dmitry Stogov , PHP Internals , Nikita Popov , Aaron Piotrowski , Levi Morrison Content-Transfer-Encoding: quoted-printable Message-ID: References: <33BCE1D0-BA6D-464C-B23D-69AF71356111@ajf.me> <3932E76B-DC75-40CD-8B1A-B84F387707CC@ajf.me> <1EFE20ED-ED80-47D1-B697-58CA4359CA62@ajf.me> To: Bob Weinand X-Mailer: Apple Mail (2.2098) Subject: Re: [PHP-DEV] Fix division by zero to throw exception (round 2) From: ajf@ajf.me (Andrea Faulds) Hi Bob, > On 2 Jul 2015, at 01:26, Bob Weinand wrote: >=20 >> Am 29.06.2015 um 19:14 schrieb Andrea Faulds : >>=20 >> Hmm. Using Error might make some sense given it used to raise = E_WARNING. I think DivisionByZeroError sounds like a good idea. >=20 > Hey, >=20 > I just committed that to master=E2=80=A6 Great! > But I noticed that intdiv(PHP_INT_MIN, -1) isn't very well suited for = a DivisionByZeroError. >=20 > What do you think about adding an ArithmeticError for that case (and = making DivisionByZeroError subclass of it)? > That ArithmeticError could then be reused for negative bitshifts, = which would solve the question what to do with that too. Well, that specific case is integer overflow. Normally in PHP we just = upgrade to float instead of throwing an error in these situations, but = for intdiv() I didn=E2=80=99t think that made sense (it=E2=80=99s = *integer* division). So, maybe OverflowError would be a better name. But = we don=E2=80=99t really do overflow errors anywhere else that I can = think of, so the more general ArithmeticError might be fine. Thanks. -- Andrea Faulds http://ajf.me/