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:
Owen Yamauchi
2013-05-17 10:37:45 -07:00
commit de Sara Golemon
commit f537fa7cc1
3 arquivos alterados com 20 adições e 0 exclusões
+2
Ver Arquivo
@@ -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;
}
+11
Ver Arquivo
@@ -0,0 +1,11 @@
<?php
// Copyright 2004-present Facebook. All Rights Reserved.
var_dump(json_decode(
<<<EOT
{
"staticBitmask": {},
"spaceId": 3
}
EOT
, true));
+7
Ver Arquivo
@@ -0,0 +1,7 @@
array(2) {
["staticBitmask"]=>
array(0) {
}
["spaceId"]=>
int(3)
}