Skip to content

Commit c795cc8

Browse files
mszabo-wikiaGitHub Enterprise
authored andcommitted
WIN-4504 | Remove notices from Slack ext/json patches (facebook#114)
ext/json contains a set of temporary patches for backwards compatibility with the jsonc parser, emitting notices when input is encountered that would fail to parse were it not for these patches. However, almost every call to `json_decode_mixed` in webapp is conveniently prefixed with the error silence operator `@`, so we don't really hear from them much. So, remove the notices outright. If we ever want to invest into removing the patches, we can implement the logging in a different way.
1 parent fddbe36 commit c795cc8

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

hphp/runtime/ext/json/JSON_parser.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,15 +1328,7 @@ bool JSON_parser(Variant &z, const char *p, int length, bool const assoc,
13281328
// Fast-case most common transition: append a simple string character.
13291329
if (state == 3 && type == KindOfString) {
13301330
while (b != '\"' && b != '\\' && b != '\'' && b <= 127 && (b >= ' ' || b == '\n' || b == '\t')) {
1331-
// @slack temporary patch to remove USE_JSONC
1332-
if (b == '\n') {
1333-
raise_notice("Slack json_decode patch - temporarily allowing newline in json for backwards compatibility");
1334-
}
1335-
1336-
// @slack temporary patch to remove USE_JSONC
1337-
if (b == '\t') {
1338-
raise_notice("Slack json_decode patch - temporarily allowing tab in json for backwards compatibility");
1339-
}
1331+
// @slack temporary patch accepting newlines and tabulators to remove USE_JSONC
13401332
buf->append((char)b);
13411333
b = decoder.decode();
13421334
}

hphp/runtime/ext/json/ext_json.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ TypedValue HHVM_FUNCTION(json_decode, const String& json,
228228
const auto loose_ok =
229229
JSON_parser(z, json.data(), json.size(), assoc, depth, parser_options);
230230
if (loose_ok) {
231-
raise_notice("Slack json_decode patch - implicitly applied JSON_FB_LOOSE for more permissive parsing after json_decode failure");
232231
return tvReturn(std::move(z));
233232
}
234233
}
@@ -299,9 +298,6 @@ TypedValue HHVM_FUNCTION(json_decode, const String& json,
299298
// @slack: commented out section is a temporary patch
300299
if (/*(options & k_JSON_FB_LOOSE) &&*/ json.size() > 1 &&
301300
ch0 == '\'' && json.charAt(json.size() - 1) == '\'') {
302-
if (!(options & k_JSON_FB_LOOSE)) {
303-
raise_notice("Slack json_decode patch - temporarily allowing single quoted json keys for JSON_C backwards compatibility");
304-
}
305301
json_set_last_error_code(json_error_codes::JSON_ERROR_NONE);
306302
return tvReturn(json.substr(1, json.size() - 2));
307303
}

0 commit comments

Comments
 (0)