Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86994 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74303 invoked from network); 2 Jul 2015 07:59:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2015 07:59:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.223.176 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.223.176 mail-ie0-f176.google.com Received: from [209.85.223.176] ([209.85.223.176:33571] helo=mail-ie0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/F4-20693-D4FE4955 for ; Thu, 02 Jul 2015 03:59:10 -0400 Received: by ieqy10 with SMTP id y10so51384821ieq.0 for ; Thu, 02 Jul 2015 00:59:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ECtcZOexdcokhCJ6tOPCwOQFpW7Hq8hUU+Z63o/I6ZU=; b=AJQTW4usWOcfsHtU90qySDLnUjbdLe5aXtaKY1A5vcSn6iXNZE3kDjfAGlVYVOxPjA 4iRgmBNRtdAPij5C/RV0P+OEWSpUYqFrOkP8HNSBi3qGVjMJkU6LP/xol/mkIy1Mciex Q+Uq0pI2jhxpsFvQNt+b9bfOfJSwSFaYymueA1AyG4F64jqVSCrF75I0OHULxoYORS4K ZQKS649jdjuPHJ3bcBxeXmh1qeF4yS10nz0Rf8f3hFHaI6BlCXLfSHiUkO/Zw2n8OF9J gW1vK1mGCiSdPmZjvQxVD97vP6SF36/G48HQh4LIj3oVM3ZlBPCcB3/tfnwHgqdMB2re AgwQ== X-Gm-Message-State: ALoCoQnRfY62ZeMmOcKfUo746vkS5PHQwj5/EhchC1qr5XAfq70brtkqeXpFu3TyX7B/VekUESbY1NJnHpJZVKE+Lya1Nv2GvdXjB87pJH3g6JoHnvD1yAyT0pEuGyJu8B6Tf7KgrGJZCx9i3lL7Z3R4RYjM5Ta9z/886naOQtWAt7XxY+n5/hk= MIME-Version: 1.0 X-Received: by 10.107.17.137 with SMTP id 9mr42471939ior.28.1435823946384; Thu, 02 Jul 2015 00:59:06 -0700 (PDT) Received: by 10.50.241.50 with HTTP; Thu, 2 Jul 2015 00:59:06 -0700 (PDT) In-Reply-To: References: <33BCE1D0-BA6D-464C-B23D-69AF71356111@ajf.me> <3932E76B-DC75-40CD-8B1A-B84F387707CC@ajf.me> <1EFE20ED-ED80-47D1-B697-58CA4359CA62@ajf.me> Date: Thu, 2 Jul 2015 10:59:06 +0300 Message-ID: To: Bob Weinand Cc: Andrea Faulds , PHP Internals , Nikita Popov , Aaron Piotrowski , Levi Morrison Content-Type: multipart/alternative; boundary=001a113f25dc48eaff0519dfd0f4 Subject: Re: [PHP-DEV] Fix division by zero to throw exception (round 2) From: dmitry@zend.com (Dmitry Stogov) --001a113f25dc48eaff0519dfd0f4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Jul 2, 2015 at 3:26 AM, Bob Weinand wrote: > > Am 29.06.2015 um 19:14 schrieb Andrea Faulds : > > > > Hi again, > > > >> On 29 Jun 2015, at 18:02, Bob Weinand wrote: > >> > >> Yes, it generally makes sense... > >> Then I have other questions: > >> > >> - Why do we then still have a Warning? Either we have well-defined > behavior, or we throw an exception. Well-defined behavior *plus* a warnin= g > is IMO non-sense. > > > > That=E2=80=99s weird, yeah. We don=E2=80=99t throw warnings for the mat= h functions when > you give them odd inputs, e.g. sin(INF) is just NAN, no warning. > > > > I think removing it would make sense. > > > >> - 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). > > > > 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. > I think we should introduce ArithmeticError, as you propose. Thanks. Dmitry. > > Thanks, > Bob --001a113f25dc48eaff0519dfd0f4--