Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86995 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83117 invoked from network); 2 Jul 2015 08:45:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2015 08:45:04 -0000 Authentication-Results: pb1.pair.com header.from=kelerest123@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kelerest123@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.45 as permitted sender) X-PHP-List-Original-Sender: kelerest123@gmail.com X-Host-Fingerprint: 209.85.218.45 mail-oi0-f45.google.com Received: from [209.85.218.45] ([209.85.218.45:34133] helo=mail-oi0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/55-20693-F0AF4955 for ; Thu, 02 Jul 2015 04:45:03 -0400 Received: by oigx81 with SMTP id x81so50790382oig.1 for ; Thu, 02 Jul 2015 01:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=2EmA7SjZACSToJ+IaU6G/IcDCG3MkAT/qzSYs2AXPeo=; b=I9HKwGJ3iH6EeLOUVDKc6hxbOPOHmA9RKdSdbRhBhF99LWY2O5cyMzjWidgt7g/YwC DGDtylw8OHTtSBRiiAG+J+ZNDgXhoZzR3TenRmxJZhACZl5o3FntepavF9vzLfzgaSoT gD7WT+q5UeTRiG910OpmAoKdh26IMGgpT0ppEdOccdyzKlqZUGw5Flnn0zd0ClKgZ9Kx 5fl3m+LNoVO++4lW4GQTYV3An5477TJpdN4fuBXmkZlg3z11N0U+7aROJT3phRRxY146 5MtEJXP73At2oBOC/RK58FqT05XaHOVrZmJJk/Qz5JVAMGdK2XSoxPu3IB0uE4C0Yd2b JkNA== X-Received: by 10.182.94.168 with SMTP id dd8mr88317obb.31.1435826700470; Thu, 02 Jul 2015 01:45:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.109.33 with HTTP; Thu, 2 Jul 2015 01:44:41 -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:44:41 +0200 Message-ID: To: Dmitry Stogov Cc: Bob Weinand , Andrea Faulds , PHP Internals , Nikita Popov , Aaron Piotrowski , Levi Morrison Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Fix division by zero to throw exception (round 2) From: kelerest123@gmail.com (=?UTF-8?B?SmFrdWIgS3Viw63EjWVr?=) +1 for everything proposed here :-) Kubo2 2015-07-02 9:59 GMT+02:00 Dmitry Stogov : > 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 warni= ng >> is IMO non-sense. >> > >> > That=E2=80=99s weird, yeah. We don=E2=80=99t throw warnings for the ma= th 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_WARNIN= G. >> 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