Commit c54c15c25ca for php.net

commit c54c15c25ca2cfe041c165faad5c131530476842
Author: arshidkv12 <arshidkv12@gmail.com>
Date:   Tue Jun 23 18:39:32 2026 +0530

    ext/standard Fix round() for large integral doubles (#22461)

    Closes #22461
    Closes #22411
    Fixes #22410

diff --git a/NEWS b/NEWS
index 1e917d3f01c..b2e8d22465b 100644
--- a/NEWS
+++ b/NEWS
@@ -100,6 +100,8 @@ PHP                                                                        NEWS
   . Fixed a memory leak in array_merge_recursive() when the recursive merge of
     an object converted to an array fails. (David Carlier)
   . Fixed read buffer compaction in php_stream_filter_flush(). (crystarm)
+  . Fixed bug GH-22410 (Incorrect float behavior with large numbers).
+    (arshidkv12)

 - SimpleXML:
   . Fixed writing to a dimension of the object returned by attributes() not
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 758b352f90f..09d98298104 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -172,6 +172,10 @@ PHPAPI double _php_math_round(double value, int places, int mode) {
 		return value;
 	}

+	if (places == 0 && value == trunc(value)) {
+        return value;
+    }
+
 	places = places < INT_MIN+1 ? INT_MIN+1 : places;

 	exponent = php_intpow10(abs(places));
diff --git a/ext/standard/tests/math/gh22410.phpt b/ext/standard/tests/math/gh22410.phpt
new file mode 100644
index 00000000000..db2e92c3e6d
--- /dev/null
+++ b/ext/standard/tests/math/gh22410.phpt
@@ -0,0 +1,14 @@
+--TEST--
+gh-22410: round() preserves integral doubles
+--FILE--
+<?php
+var_dump(round(1.0));
+var_dump(round(-1.0));
+var_dump(round((float) 9003241321073828));
+var_dump(round((float) -9003241321073828));
+?>
+--EXPECT--
+float(1)
+float(-1)
+float(9003241321073828)
+float(-9003241321073828)