Re: Fix division by zero to throw exception (round 2)

From: Date: Tue, 30 Jun 2015 06:48:30 +0000
Subject: Re: Fix division by zero to throw exception (round 2)
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-86967@lists.php.net to get a copy of this message
I, personally, don't have strong opinion. Both behaviors work for me. Bob, if you are going to change this, please show the patch first. Thanks. Dmitry. On Mon, Jun 29, 2015 at 8:14 PM, Andrea Faulds <ajf@ajf.me> wrote: > Hi again, > > > On 29 Jun 2015, at 18:02, Bob Weinand <bobwei9@hotmail.com> 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 warning > is IMO non-sense. > > That’s weird, yeah. We don’t throw warnings for the math 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. > > -- > Andrea Faulds > http://ajf.me/ > > > > >

« previous php.internals (#86967) next »