|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78660 Round works different on PHP 7.4
Submitted: 2019-10-10 11:48 UTC Modified: 2019-10-11 15:12 UTC
From: s dot sayakci at shopware dot com Assigned: nikic (profile)
Status: Closed Package: *Math Functions
PHP Version: 7.4.0RC3 OS: Linux (NixOs)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: s dot sayakci at shopware dot com
New email:
PHP Version: OS:


 [2019-10-10 11:48 UTC] s dot sayakci at shopware dot com
We did found that round does work in different way in PHP 7.4 so our Tests are currently failing. I checked the and could not found any change on round function.
When you pass -1 as float to round we got 0 until PHP 7.4, now we get also -1.
Is this change intended? Cause its not mentioned.

Test script:
var_dump((string) round((float) "-0", 2));


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-10 11:56 UTC] s dot sayakci at shopware dot com
I guess it's related to
 [2019-10-11 09:15 UTC]
The following pull request has been associated:

Patch Name: fix bug #78660 rounding negative zero
On GitHub:
 [2019-10-11 15:12 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2019-10-11 15:12 UTC]
Upgrading note added in

As cmb pointed out on the PR, the new behavior complies with POSIX, which explicitly states that round(-0.0) must be -0.0.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 12:01:29 2024 UTC