facebook / facebook/hhvm

[ HipHop Debugger ] `dict[0 => NAN]` equals itself in the debugger, but not cli or server mode

Open
#9,272 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

**Describe the bug**
Comparing the value `dict[0 => NAN]` to itself is equal in the HipHop debugger `hhvm --no-config -a`. When running are script from the cli or in a webserver, these values are not equal.

**Standalone code, or other way to reproduce the problem**

```HACK
<<__EntryPoint>>
function main(): void {
echo (dict[0 => NAN] === dict[0 => NAN] ? 'equal' : 'not equal')."\n";
}
```

Steps to reproduce the behavior:
1. Run the above code from the cli using `hhvm --no-config file.hack`
2. Run the above code in web server mode using `hhvm --no-config -m server -p 8080` and visit localhost:8080/file.hack
3. Observe `not equal` being printed in both cases.
4. Start the HipHop debugger using `hhvm --no-config -a`.
5. Paste the following statement `echo (dict[0 => NAN] === dict[0 => NAN] ? 'equal' : 'not equal')."\n";`.
6. Observe `equal` being printed.

**Expected behavior**

The behavior of this comparison should not differ between debugger and script mode. From my understanding, they should compare equal.

See: https://github.com/facebook/hhvm/blob/master/hphp/test/slow/comparisons/nan_array_id_test.php and https://github.com/facebook/hhvm/blob/master/hphp/test/slow/comparisons/nan_array_id_test.php.expect

My understanding could be wrong here, so please verify what the proper behavior should be with someone in the know first.

**Actual behavior**

Output differs between the debugger and cli / server mode.

**Environment**
- Operating system
> Ubuntu 18.04
- Installation method
> apt-get with dl.hhvm.com repository
- HHVM Version
```
HipHop VM 4.169.0 (rel) (non-lowptr)
Compiler: 1663640616_852546864
Repo schema: ce4145c518e16986e860178941c05dc9f11eab61
```

**Additional context**
N/A

Contributor guide

Open the contributing guide

Research direction

Start by running the Hack reproduction in CLI mode and with `hhvm --no-config -a`, then read `hphp/test/slow/comparisons/nan_array_id_test.php` and its `.expect` file. Trace how the debugger evaluates the comparison versus script mode, and verify the expected behavior with a relevant maintainer. Done means the modes agree and the comparison test documents the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, php
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.