JSON parser: fix empty dictionaries inside of dictionaries
I broke this with my change to stop boxing everything. It was dropping empty dictionaries inside dictionaries, because the "}" of empty dictionaries is a different parser action from the "}" of nonempty dictionaries, and I'd neglected to update it. (The fact that no tests caught this before is a little unsettling.)
Esse commit está contido em:
@@ -551,6 +551,8 @@ bool JSON_parser(Variant &z, const char *p, int length, bool assoc/*<fb>*/,
|
||||
empty }
|
||||
*/
|
||||
case -9:
|
||||
attach_zval(the_json, JSON(the_kstack)[JSON(the_top)], assoc);
|
||||
|
||||
if (!pop(the_json, MODE_KEY)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
var_dump(json_decode(
|
||||
<<<EOT
|
||||
{
|
||||
"staticBitmask": {},
|
||||
"spaceId": 3
|
||||
}
|
||||
EOT
|
||||
, true));
|
||||
@@ -0,0 +1,7 @@
|
||||
array(2) {
|
||||
["staticBitmask"]=>
|
||||
array(0) {
|
||||
}
|
||||
["spaceId"]=>
|
||||
int(3)
|
||||
}
|
||||
Referência em uma Nova Issue
Bloquear um usuário