number_format rounding in 8.4 is different from older versions
Open
Nobody has claimed this yet.
Bug
Status: Invalid
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
<?php
$a = [0.06,0.0025,0.0225,0.01];
$s = array_sum($a);
echo $s . "\n";
echo number_format($s, 2, '.', '');
Output for 8.4.1 - 8.4.5
0.095
0.09
Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.19
0.095
0.10
PHP Version
8.4.5
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the number_format() entry point and the supplied reproducer, then compare its behavior across the listed PHP 8.2, 8.3, and 8.4 versions. Determine which rounding behavior is intended and verify that the final behavior is covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100