Re: Fix division by zero to throw exception
| From: | Dmitry Stogov | Date: | Fri, 03 Apr 2015 20:34:24 +0000 |
| Subject: | Re: Fix division by zero to throw exception | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85724@lists.php.net to get a copy of this message | ||
3) One more problem is modulo :(
$ sapi/cli/php -n -r "var_dump(1 % 0);"
Warning: Division by zero in Command line code on line 1
bool(false)
Thanks. Dmitry.
On Fri, Apr 3, 2015 at 10:50 PM, Dmitry Stogov <dmitry@zend.com> wrote:
>
>
> On Fri, Apr 3, 2015 at 10:34 PM, Levi Morrison <levim@php.net> wrote:
>
>> > 2) Very similar weird behavior was introduced for shift with negative
>> > offsets. I also propose to change it in the same way (Fatal error at
>> > compile-time, Exception in run-time).
>>
>> Can you describe the weird behavior for shifts with negative offsets?
>>
>
> $ sapi/cli/php -n -r "var_dump(1 << -1);"
>
> Warning: Bit shift by negative number in Command line code on line 1
> bool(false)
>
> Currently this expression may also be evaluated at compile-time.
>
> Thanks. Dmitry.
>
>