fix(problem): force encoding extra_config as object

This commit is contained in:
Baoshuo Ren 2023-02-07 06:53:53 +08:00
parent 6ff83e810b
commit 15a4b23b80
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
4 changed files with 4 additions and 4 deletions

View File

@ -91,7 +91,7 @@ $new_remote_problem_form->handle = function (&$vdata) {
'time_limit' => $data['time_limit'],
'memory_limit' => $data['memory_limit'],
];
$enc_extra_config = json_encode($extra_config);
$enc_extra_config = json_encode($extra_config, JSON_FORCE_OBJECT);
DB::insert([
"insert into problems",

View File

@ -167,7 +167,7 @@ if (isSuperUser(Auth::user())) {
if ($extra_config === null) {
return '不是合法的JSON';
}
$vdata['extra_config'] = json_encode($extra_config);
$vdata['extra_config'] = json_encode($extra_config, JSON_FORCE_OBJECT);
},
]);
$info_form->handle = function (&$vdata) use ($problem) {

View File

@ -142,7 +142,7 @@ if (UOJProblem::info('type') == 'remote') {
'time_limit' => $data['time_limit'],
'memory_limit' => $data['memory_limit'],
];
$enc_extra_config = json_encode($extra_config);
$enc_extra_config = json_encode($extra_config, JSON_FORCE_OBJECT);
DB::update([
"update problems",

View File

@ -32,7 +32,7 @@ return function ($type) {
DB::update([
"update problems",
"set", [
"extra_config" => json_encode($extra_config),
"extra_config" => json_encode($extra_config, JSON_FORCE_OBJECT),
],
"where", [
"id" => $problem->info['id'],