Thread View: php.bugs
1 messages
1 total messages
Started by mvorisek
Thu, 15 May 2025 09:46
[php-src] Issue #18563: NAN in array compare
Author: mvorisek
Date: Thu, 15 May 2025 09:46
Date: Thu, 15 May 2025 09:46
47 lines
3260 bytes
3260 bytes
Issue: https://github.com/php/php-src/issues/18563 Author: mvorisek ### Description The following code: ```php <?php $a = [NAN]; $b = $a; var_dump($a === $b); $a = [NAN]; $b = [NAN]; var_dump($a === $b); ``` Resulted in this output: ``` bool(true) bool(false) ``` But I expected this output instead: ``` bool(true) bool(true) ``` (or both false) online repro: https://3v4l.org/CVGBt I understand the reason - in the 1st case, the zval reference is the same, thus used for the comparison, which is valid for all values excl. NAN. In the 2nd case, zval references are not the same, thus all array items are compared and because currently NAN === NAN returns false, the result is false. Because of this compare behaviour inconsistency I propose to fix this by changing the result of NAN === NAN to be true. At least in when in arrays. ### PHP Version ```plain any ``` ### Operating System any
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads