Skip to content

Float addition/division issues #18947

Open
@AlexWinder

Description

@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 docker-library/php#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:

[
            $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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions