File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,12 @@ function read_credentials(): void
3333 global $ endpoints ;
3434
3535 $ credfile = ETCDIR . '/restapi.secret ' ;
36- $ credentials = @file ($ credfile );
37- if (!$ credentials ) {
38- error ("Cannot read REST API credentials file " . $ credfile );
36+ if (!is_readable ($ credfile )) {
37+ error ("REST API credentials file " . $ credfile . " is not readable or does not exist. " );
38+ }
39+ $ credentials = file ($ credfile );
40+ if ($ credentials === false ) {
41+ error ("Error reading REST API credentials file " . $ credfile );
3942 }
4043 $ lineno = 0 ;
4144 foreach ($ credentials as $ credential ) {
@@ -1500,8 +1503,8 @@ function judge(array $judgeTask): bool
15001503 $ runtime = null ;
15011504 $ metadata = read_metadata ($ passdir . '/program.meta ' );
15021505
1503- if (isset ($ metadata ['time-used ' ])) {
1504- $ runtime = @ $ metadata [$ metadata ['time-used ' ]];
1506+ if (isset ($ metadata ['time-used ' ]) && array_key_exists ( $ metadata [ ' time-used ' ], $ metadata ) ) {
1507+ $ runtime = $ metadata [$ metadata ['time-used ' ]];
15051508 }
15061509
15071510 if ($ result === 'compare-error ' ) {
You can’t perform that action at this time.
0 commit comments