[php-src] Issue #23662: print_r() results in warning: unexpected NAN value was coerced to string

From: Date: Fri, 11 Sep 2026 13:58:50 +0000
Subject: [php-src] Issue #23662: print_r() results in warning: unexpected NAN value was coerced to string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252727@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/23662 Author: ausi ### Description The following code: ```php <?php print_r([NAN]); ``` Resulted in this output: ``` Warning: unexpected NAN value was coerced to string in /in/IW2fE on line 3 Array ( [0] => NAN ) ``` But I expected this output instead: ``` Array ( [0] => NAN ) ``` This warning got introduced in https://github.com/php/php-src/pull/19573 but I don’t think affecting print_r() was intended as this function is supposed to _“Print human-readable information about a variable”_. The related functions var_dump() and var_export() are not affected by this warning. ### PHP Version ```plain PHP 8.5.8 (cli) (built: Jul 1 2026 03:46:27) (NTS) Copyright (c) The PHP Group Built by Homebrew Zend Engine v4.5.8, Copyright (c) Zend Technologies with Zend OPcache v8.5.8, Copyright (c), by Zend Technologies ``` ### Operating System MacOS 26.6.2

« previous php.bugs (#252727) next »