[php-src] Issue #18947: Float division issues
| From: | AlexWinder | Date: | Thu, 26 Jun 2025 09:50:19 +0000 |
| Subject: | [php-src] Issue #18947: Float division issues | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250327@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/18947
Author: AlexWinder
### Description
I am cross-posting this for visibility, but I'm unsure if this is primarily a problem with PHP
in general, or with PHP-FPM on Docker. I also posted this at https://github.com/docker-library/php/issues/1588
We have found an issue with our PHP Docker environment since an update has been pushed for the
latest version of PHP
8.4.
We are using the php:8.4-fpm-bookworm base image.
We have the following PHP code:
```php
[
$this->north,
$this->south,
$this->east,
$this->west,
($this->east + $this->west),
($this->east + $this->west) / 2,
($this->east + $this->west) / 2.0
]
```
Where this doesn't return consistently, sometimes we get this output, which is correct:
```
[
38.924993216059,
38.907006783941,
1.4595583969657,
1.4364416030343,
2.896,
1.448,
1.448
]
```
Other times we get this output, which is breaking division:
```
[
38.924993216059,
38.907006783941,
1.4595583969657,
1.4364416030343,
1.369313176327556e-309,
6.8465658816378e-310,
6.8465658816378e-310
]
```
The output is not consistent and sometimes returns the correct output, sometimes not.
This was highlighted in our automation tests, and with no changes to our underlying code. If we make
use of the php:8.4.7-fpm-bookworm then the output is consistent and is correct. This
appears to have been introduced with the recent update.
### PHP Version
```plain
PHP 8.4.8 (cli) (built: Jun 25 2025 19:13:38) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.8, Copyright (c) Zend Technologies
with Zend OPcache v8.4.8, Copyright (c), by Zend Technologies
```
### Operating System
Docker - php:8.4-fpm-bookworm