File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ int json_yydebug = 1;
74
74
%code {
75
75
static int php_json_yylex (union YYSTYPE *value, php_json_parser *parser);
76
76
static void php_json_yyerror (php_json_parser *parser, char const *msg);
77
+ static int php_json_parser_array_create (php_json_parser *parser, zval *array);
78
+ static int php_json_parser_object_create (php_json_parser *parser, zval *array);
77
79
78
80
}
79
81
@@ -118,7 +120,11 @@ object_end:
118
120
members :
119
121
/* empty */
120
122
{
121
- parser->methods.object_create(parser, &$$ );
123
+ if ((parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) && parser->methods.object_create == php_json_parser_object_create) {
124
+ ZVAL_EMPTY_ARRAY (&$$);
125
+ } else {
126
+ parser->methods.object_create(parser, &$$ );
127
+ }
122
128
}
123
129
| member
124
130
;
@@ -178,7 +184,11 @@ array_end:
178
184
elements :
179
185
/* empty */
180
186
{
181
- parser->methods.array_create(parser, &$$ );
187
+ if (parser->methods.array_create == php_json_parser_array_create) {
188
+ ZVAL_EMPTY_ARRAY (&$$);
189
+ } else {
190
+ parser->methods.array_create(parser, &$$ );
191
+ }
182
192
}
183
193
| element
184
194
;
You can’t perform that action at this time.
0 commit comments