Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86991 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92195 invoked from network); 2 Jul 2015 00:26:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2015 00:26:17 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.167 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.167 blu004-omc4s28.hotmail.com Received: from [65.55.111.167] ([65.55.111.167:59657] helo=BLU004-OMC4S28.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/72-20693-62584955 for ; Wed, 01 Jul 2015 20:26:15 -0400 Received: from BLU436-SMTP69 ([65.55.111.136]) by BLU004-OMC4S28.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Wed, 1 Jul 2015 17:26:11 -0700 X-TMN: [ydsCHS3JmvLU7VaWh1yUeqjoxQNMoLpp] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) In-Reply-To: <1EFE20ED-ED80-47D1-B697-58CA4359CA62@ajf.me> Date: Thu, 2 Jul 2015 02:26:06 +0200 CC: Dmitry Stogov , PHP Internals , Nikita Popov , Aaron Piotrowski , Levi Morrison Content-Transfer-Encoding: quoted-printable References: <33BCE1D0-BA6D-464C-B23D-69AF71356111@ajf.me> <3932E76B-DC75-40CD-8B1A-B84F387707CC@ajf.me> <1EFE20ED-ED80-47D1-B697-58CA4359CA62@ajf.me> To: Andrea Faulds X-Mailer: Apple Mail (2.2098) X-OriginalArrivalTime: 02 Jul 2015 00:26:09.0965 (UTC) FILETIME=[B1ADA5D0:01D0B45D] Subject: Re: [PHP-DEV] Fix division by zero to throw exception (round 2) From: bobwei9@hotmail.com (Bob Weinand) > Am 29.06.2015 um 19:14 schrieb Andrea Faulds : >=20 > Hi again, >=20 >> On 29 Jun 2015, at 18:02, Bob Weinand wrote: >>=20 >> Yes, it generally makes sense... >> Then I have other questions: >>=20 >> - Why do we then still have a Warning? Either we have well-defined = behavior, or we throw an exception. Well-defined behavior *plus* a = warning is IMO non-sense. >=20 > That=E2=80=99s weird, yeah. We don=E2=80=99t throw warnings for the = math functions when you give them odd inputs, e.g. sin(INF) is just NAN, = no warning. >=20 > I think removing it would make sense. >=20 >> - Is it intentional for intdiv and % to throw an Exception instead of = Error or some more specific DivisionByZeroError or similar? (yes, I = know, Error is only very recent, but the question still needs to be = asked). >=20 > Hmm. Using Error might make some sense given it used to raise = E_WARNING. I think DivisionByZeroError sounds like a good idea. Hey, I just committed that to master=E2=80=A6 But I noticed that intdiv(PHP_INT_MIN, -1) isn't very well suited for a = DivisionByZeroError. 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. Thanks, Bob=