Commit 30920e9004b for php.net

commit 30920e9004be86f9cabc64e258b63c9806a878f3
Author: Manish Kafle <manishkafle03@gmail.com>
Date:   Sat Sep 12 05:54:42 2026 +0000

    Fix GH-23662: avoid NAN warning in print_r()

diff --git a/NEWS b/NEWS
index 98f99ad217e..ead9e3308b9 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PHP                                                                        NEWS
   . Fixed bug GH-23644 (Optimizer leaves a constant-vs-constant comparison
     unfolded, crashing the VM in zval_undefined_cv). (ndossche)
   . Fixed OSS-Fuzz 532353396 (assertion failure with static type). (Girgias)
+  . Fix GH-23662 (Avoid NAN warning in print_r()). (CodedByManish)

 - CLI
   . Fix GH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during
diff --git a/Zend/tests/gh23662.phpt b/Zend/tests/gh23662.phpt
new file mode 100644
index 00000000000..426b6e2aa5d
--- /dev/null
+++ b/Zend/tests/gh23662.phpt
@@ -0,0 +1,12 @@
+--TEST--
+GH-23662 (print_r() results in warning for NAN)
+--FILE--
+<?php
+print_r(NAN);
+print_r([NAN]);
+?>
+--EXPECT--
+NANArray
+(
+    [0] => NAN
+)
diff --git a/Zend/zend.c b/Zend/zend.c
index aa621c4daa8..43cf8f5ccef 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -597,6 +597,9 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
 		case IS_LONG:
 			smart_str_append_long(buf, Z_LVAL_P(expr));
 			break;
+		case IS_DOUBLE:
+			smart_str_append_double(buf, Z_DVAL_P(expr), EG(precision), false);
+			break;
 		case IS_REFERENCE:
 			zend_print_zval_r_to_buf(buf, Z_REFVAL_P(expr), indent);
 			break;