Parse HHBC option as bool only if it's a flag
Summary:
The JSON config passed to hh_single_compile by HHVM contains a
**superset** of HHBC-relevant config, e.g.:
{ ...
"hhvm.trusted_db_path": {
"access": 4,
"local_value": "",
"global_value": "" }
}
Therefore, skip the interpretation of such an option as flag in Rust
**until *after*** it's determined that it indeed represents a flag.
Now, unrelated HHVM options with values such as:
- "" (empty string); or
- "
12345678901234567890" (integer-overflowing constant)
no longer panic / make the whole JSON parse to fail
(as a result of parsing a non-int/bool-convertible string).
Add regression tests for these two cases.
Finally, treat empty string values as false for flags as in OCaml code.
Reviewed By: dabek
Differential Revision:
D20265758
fbshipit-source-id:
74cac1d8a718c35a06a804aee5f9a97268f3ef30