Permalink
Browse files

Explicit intish cast in json_decode

Summary: What it says on the tin

Reviewed By: huntergoldstein

Differential Revision: D13053395

fbshipit-source-id: 58c7acc447f911981af41d0e3654b260517ba420
  • Loading branch information...
jjgriego authored and hhvm-bot committed Nov 15, 2018
1 parent f84da1f commit dc265de5e5109ec7e08c91d761666fe2506cb7a3
@@ -901,9 +901,19 @@ static void object_set(Variant &var,
forceToDict(var).set(key, value);
} else if (container_type == JSONContainerType::DARRAYS ||
container_type == JSONContainerType::DARRAYS_AND_VARRAYS) {
forceToDArray(var).set(key, value);
int64_t i;
if (key.get()->isStrictlyInteger(i)) {
forceToDArray(var).set(i, value);
} else {
forceToDArray(var).set(key, value);
}
} else {
forceToArray(var).set(key, value);
int64_t i;
if (key.get()->isStrictlyInteger(i)) {
forceToArray(var).set(i, value);
} else {
forceToArray(var).set(key, value);
}
}
}
}
@@ -148,8 +148,6 @@ TypedValue HHVM_FUNCTION(json_encode, const Variant& value,
TypedValue HHVM_FUNCTION(json_decode, const String& json,
bool assoc, int64_t depth, int64_t options) {
SuppressHACIntishCastNotices shacn;
json_set_last_error_code(json_error_codes::JSON_ERROR_NONE);
if (json.empty()) {
@@ -0,0 +1,6 @@
<?hh
<<__EntryPoint>>
function main() {
var_dump(json_decode("{\"1\": 1, \"2\": \"2\"}", true, 512, JSON_FB_DARRAYS));
}
@@ -0,0 +1,6 @@
array(2) {
[1]=>
int(1)
[2]=>
string(1) "2"
}
@@ -0,0 +1,2 @@
-vRuntime.Eval.HackArrCompatNotices=1
-vRuntime.Eval.HackArrCompatCheckIntishCast=1
@@ -0,0 +1,2 @@
-vEval.HackArrCompatNotices=1
-vEval.HackArrCompatCheckIntishCast=1
@@ -0,0 +1,6 @@
<?hh
<<__EntryPoint>>
function main() {
var_dump(json_decode("{\"1\": 1, \"2\": \"2\"}", true, 512, JSON_FB_DARRAYS));
}
@@ -0,0 +1,6 @@
dict(2) {
[1]=>
int(1)
[2]=>
string(1) "2"
}
@@ -0,0 +1,3 @@
-vRuntime.Eval.HackArrCompatNotices=1
-vRuntime.Eval.HackArrCompatCheckIntishCast=1
-vRuntime.Eval.HackArrDVArrs=1
@@ -0,0 +1,3 @@
-vEval.HackArrCompatNotices=1
-vEval.HackArrCompatCheckIntishCast=1
-vEval.HackArrDVArrs=1

0 comments on commit dc265de

Please sign in to comment.