[php-src] Issue #8015: negative powers() do not raise a DivisionByZeroError
| From: | exakat | Date: | Tue, 01 Feb 2022 09:10:28 +0000 |
| Subject: | [php-src] Issue #8015: negative powers() do not raise a DivisionByZeroError | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239391@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8015
Author: exakat
### Description
Raising to a negative power is similar to a division, so applying those to 0 should raise a
DivisionByZeroError
The following code:
```php
<?php
echo 0 ** -1;
echo 0 ** -2;
echo pow(0, -4);
```
Resulted in this output:
```
INF
INF
INF
```
But I expected this output instead:
```
PHP Fatal error: Uncaught DivisionByZeroError: Division by zero
```
### PHP Version
8.1.2
### Operating System
N/A