@@ -243,10 +243,10 @@ private function validateConfig(array &$config, array &$problems = null): bool
243
243
};
244
244
245
245
// << LDAP
246
- if (!array_key_exists ( "ldap " , $ config ) || !is_array ($ config ["ldap " ])) {
246
+ if (!isset ( $ config [ "ldap " ] ) || !is_array ($ config ["ldap " ])) {
247
247
$ addProblem ("error " , "ldap missing. " );
248
248
} else {
249
- if (!array_key_exists ( " debug " , $ config ["ldap " ])) {
249
+ if (!isset ( $ config ["ldap " ][ " debug " ])) {
250
250
$ addProblem ("warning " , "ldap->debug missing. (Assuming false.) " );
251
251
$ config ["ldap " ]["debug " ] = false ;
252
252
} else if (null === $ config ["ldap " ]["debug " ]) {
@@ -257,16 +257,16 @@ private function validateConfig(array &$config, array &$problems = null): bool
257
257
}
258
258
259
259
// << LDAP server
260
- if (!array_key_exists ( " server " , $ config ["ldap " ]) || !is_array ($ config ["ldap " ]["server " ])) {
260
+ if (!isset ( $ config ["ldap " ][ " server " ]) || !is_array ($ config ["ldap " ]["server " ])) {
261
261
$ addProblem ("error " , "ldap->server missing. " );
262
262
} else {
263
- if (!array_key_exists ( " host " , $ config ["ldap " ]["server " ])) {
263
+ if (!isset ( $ config ["ldap " ]["server " ][ " host " ])) {
264
264
$ addProblem ("error " , "ldap->server->host missing. " );
265
265
} else if (!$ config ["ldap " ]["server " ]["host " ] = trim ($ config ["ldap " ]["server " ]["host " ])) {
266
266
$ addProblem ("error " , "ldap->server->host not specified. " );
267
267
}
268
268
269
- if (!array_key_exists ( " port " , $ config ["ldap " ]["server " ])) {
269
+ if (!isset ( $ config ["ldap " ]["server " ][ " port " ])) {
270
270
$ addProblem ("warning " , "ldap->server->port missing. (It will be determined by the encryption setting.) " );
271
271
$ config ["ldap " ]["server " ]["port " ] = null ;
272
272
} else if (!$ config ["ldap " ]["server " ]["port " ] = intval ($ config ["ldap " ]["server " ]["port " ])) {
@@ -276,7 +276,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
276
276
$ addProblem ("error " , "ldap->server->port out of range. (Must be 1-65535.) " );
277
277
}
278
278
279
- if (!array_key_exists ( " version " , $ config ["ldap " ]["server " ])) {
279
+ if (!isset ( $ config ["ldap " ]["server " ][ " version " ])) {
280
280
$ addProblem ("warning " , "ldap->server->version missing. (Assuming 3.) " );
281
281
$ config ["ldap " ]["server " ]["version " ] = 3 ;
282
282
} else if (!$ config ["ldap " ]["server " ]["version " ] = intval ($ config ["ldap " ]["server " ]["version " ])) {
@@ -286,7 +286,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
286
286
$ addProblem ("error " , "ldap->server->version out of range. (Must be 1-3.) " );
287
287
}
288
288
289
- if (!array_key_exists ( " encryption " , $ config ["ldap " ]["server " ])) {
289
+ if (!isset ( $ config ["ldap " ]["server " ][ " encryption " ])) {
290
290
$ addProblem ("warning " , "ldap->server->encryption missing. (Assuming none.) " );
291
291
$ config ["ldap " ]["server " ]["encryption " ] = "none " ;
292
292
} else if (!$ config ["ldap " ]["server " ]["encryption " ] = trim ($ config ["ldap " ]["server " ]["encryption " ])) {
@@ -312,14 +312,14 @@ private function validateConfig(array &$config, array &$problems = null): bool
312
312
}
313
313
}
314
314
315
- if (!array_key_exists ( " bindDn " , $ config ["ldap " ]["server " ])) {
315
+ if (!isset ( $ config ["ldap " ]["server " ][ " bindDn " ])) {
316
316
$ addProblem ("warning " , "ldap->server->bindDn missing. (Assuming anonymous access.) " );
317
317
$ config ["ldap " ]["server " ]["bindDn " ] = null ;
318
318
} else if (!$ config ["ldap " ]["server " ]["bindDn " ] = trim ($ config ["ldap " ]["server " ]["bindDn " ])) {
319
319
$ addProblem ("warning " , "ldap->server->bindDn not specified. (Assuming anonymous access.) " );
320
320
$ config ["ldap " ]["server " ]["bindDn " ] = null ;
321
321
} else {
322
- if (!array_key_exists ( " bindPassword " , $ config ["ldap " ]["server " ])) {
322
+ if (!isset ( $ config ["ldap " ]["server " ][ " bindPassword " ])) {
323
323
$ addProblem ("warning " , "ldap->server->bindPassword missing. (Must be specified for non-anonymous access.) " );
324
324
} else if (!strlen ($ config ["ldap " ]["server " ]["bindPassword " ])) {
325
325
$ addProblem ("warning " , "ldap->server->bindPassword not specified. (Must be specified for non-anonymous access.) " );
@@ -329,66 +329,66 @@ private function validateConfig(array &$config, array &$problems = null): bool
329
329
// >> LDAP server
330
330
331
331
// << LDAP queries
332
- if (!array_key_exists ( " queries " , $ config ["ldap " ])) {
332
+ if (!isset ( $ config ["ldap " ][ " queries " ])) {
333
333
$ addProblem ("error " , "ldap->queries missing. " );
334
334
} else {
335
- if (!array_key_exists ( " baseDn " , $ config ["ldap " ]["queries " ])) {
335
+ if (!isset ( $ config ["ldap " ]["queries " ][ " baseDn " ])) {
336
336
$ addProblem ("error " , "ldap->queries->baseDn missing. " );
337
337
} else if (!$ config ["ldap " ]["queries " ]["baseDn " ] = trim ($ config ["ldap " ]["queries " ]["baseDn " ])) {
338
338
$ addProblem ("error " , "ldap->queries->baseDn not specified. " );
339
339
}
340
340
341
- if (!array_key_exists ( " userDn " , $ config ["ldap " ]["queries " ])) {
341
+ if (!isset ( $ config ["ldap " ]["queries " ][ " userDn " ])) {
342
342
$ addProblem ("error " , "ldap->queries->userDn missing. " );
343
343
} else if (!$ config ["ldap " ]["queries " ]["userDn " ] = trim ($ config ["ldap " ]["queries " ]["userDn " ])) {
344
344
// $addProblem("warning", "ldap->queries->userDn not specified.");
345
345
// This is OK: Users will be looked for from the directory root.
346
346
}
347
347
348
- if (!array_key_exists ( " userFilter " , $ config ["ldap " ]["queries " ])) {
348
+ if (!isset ( $ config ["ldap " ]["queries " ][ " userFilter " ])) {
349
349
$ addProblem ("error " , "ldap->queries->userFilter missing. " );
350
350
} else if (!$ config ["ldap " ]["queries " ]["userFilter " ] = trim ($ config ["ldap " ]["queries " ]["userFilter " ])) {
351
351
$ addProblem ("error " , "ldap->queries->userFilter not specified. " );
352
352
}
353
353
354
- if (!array_key_exists ( " userUniqueAttribute " , $ config ["ldap " ]["queries " ])) {
354
+ if (!isset ( $ config ["ldap " ]["queries " ][ " userUniqueAttribute " ])) {
355
355
$ addProblem ("error " , "ldap->queries->userUniqueAttribute missing. " );
356
356
} else if (!$ config ["ldap " ]["queries " ]["userUniqueAttribute " ] = trim ($ config ["ldap " ]["queries " ]["userUniqueAttribute " ])) {
357
357
$ addProblem ("error " , "ldap->queries->userUniqueAttribute not specified. " );
358
358
}
359
359
360
- if (!array_key_exists ( " userNameAttribute " , $ config ["ldap " ]["queries " ])) {
360
+ if (!isset ( $ config ["ldap " ]["queries " ][ " userNameAttribute " ])) {
361
361
$ addProblem ("error " , "ldap->queries->userNameAttribute missing. " );
362
362
} else if (!$ config ["ldap " ]["queries " ]["userNameAttribute " ] = trim ($ config ["ldap " ]["queries " ]["userNameAttribute " ])) {
363
363
$ addProblem ("error " , "ldap->queries->userNameAttribute not specified. " );
364
364
}
365
365
366
- if (!array_key_exists ( " userEmailAttribute " , $ config ["ldap " ]["queries " ])) {
366
+ if (!isset ( $ config ["ldap " ]["queries " ][ " userEmailAttribute " ])) {
367
367
$ addProblem ("error " , "ldap->queries->userEmailAttribute missing. " );
368
368
} else if (!$ config ["ldap " ]["queries " ]["userEmailAttribute " ] = trim ($ config ["ldap " ]["queries " ]["userEmailAttribute " ])) {
369
369
$ addProblem ("error " , "ldap->queries->userEmailAttribute not specified. " );
370
370
}
371
371
372
- if (!array_key_exists ( " groupDn " , $ config ["ldap " ]["queries " ])) {
372
+ if (!isset ( $ config ["ldap " ]["queries " ][ " groupDn " ])) {
373
373
$ addProblem ("error " , "ldap->queries->groupDn missing. " );
374
374
} else if (!$ config ["ldap " ]["queries " ]["groupDn " ] = trim ($ config ["ldap " ]["queries " ]["groupDn " ])) {
375
375
// $addProblem("error", "ldap->queries->groupDn not specified.");
376
376
// This is OK: Groups will be looked for from the directory root.
377
377
}
378
378
379
- if (!array_key_exists ( " groupFilter " , $ config ["ldap " ]["queries " ])) {
379
+ if (!isset ( $ config ["ldap " ]["queries " ][ " groupFilter " ])) {
380
380
$ addProblem ("error " , "ldap->queries->groupFilter missing. " );
381
381
} else if (!$ config ["ldap " ]["queries " ]["groupFilter " ] = trim ($ config ["ldap " ]["queries " ]["groupFilter " ])) {
382
382
$ addProblem ("error " , "ldap->queries->groupFilter not specified. " );
383
383
}
384
384
385
- if (!array_key_exists ( " groupUniqueAttribute " , $ config ["ldap " ]["queries " ])) {
385
+ if (!isset ( $ config ["ldap " ]["queries " ][ " groupUniqueAttribute " ])) {
386
386
$ addProblem ("error " , "ldap->queries->groupUniqueAttribute missing. " );
387
387
} else if (!$ config ["ldap " ]["queries " ]["groupUniqueAttribute " ] = trim ($ config ["ldap " ]["queries " ]["groupUniqueAttribute " ])) {
388
388
$ addProblem ("error " , "ldap->queries->groupUniqueAttribute not specified. " );
389
389
}
390
390
391
- if (!array_key_exists ( " groupMemberAttribute " , $ config ["ldap " ]["queries " ])) {
391
+ if (!isset ( $ config ["ldap " ]["queries " ][ " groupMemberAttribute " ])) {
392
392
$ addProblem ("error " , "ldap->queries->groupMemberAttribute missing. " );
393
393
} else if (!$ config ["ldap " ]["queries " ]["groupMemberAttribute " ] = trim ($ config ["ldap " ]["queries " ]["groupMemberAttribute " ])) {
394
394
$ addProblem ("error " , "ldap->queries->groupMemberAttribute not specified. " );
@@ -399,10 +399,10 @@ private function validateConfig(array &$config, array &$problems = null): bool
399
399
// >> LDAP
400
400
401
401
// << Gitlab
402
- if (!array_key_exists ( "gitlab " , $ config ) || !is_array ($ config ["gitlab " ])) {
402
+ if (!isset ( $ config [ "gitlab " ] ) || !is_array ($ config ["gitlab " ])) {
403
403
$ addProblem ("error " , "gitlab missing. " );
404
404
} else {
405
- if (!array_key_exists ( " debug " , $ config ["gitlab " ])) {
405
+ if (!isset ( $ config ["gitlab " ][ " debug " ])) {
406
406
$ addProblem ("warning " , "gitlab->debug missing. (Assuming false.) " );
407
407
$ config ["gitlab " ]["debug " ] = false ;
408
408
} else if (null === $ config ["gitlab " ]["debug " ]) {
@@ -413,10 +413,10 @@ private function validateConfig(array &$config, array &$problems = null): bool
413
413
}
414
414
415
415
// << Gitlab options
416
- if (!array_key_exists ( " options " , $ config ["gitlab " ]) || !is_array ($ config ["gitlab " ]["options " ])) {
416
+ if (!isset ( $ config ["gitlab " ][ " options " ]) || !is_array ($ config ["gitlab " ]["options " ])) {
417
417
$ addProblem ("error " , "gitlab->options missing. " );
418
418
} else {
419
- if (!array_key_exists ( " userNamesToIgnore " , $ config ["gitlab " ]["options " ])) {
419
+ if (!isset ( $ config ["gitlab " ]["options " ][ " userNamesToIgnore " ])) {
420
420
$ addProblem ("warning " , "gitlab->options->userNamesToIgnore missing. (Assuming none.) " );
421
421
$ config ["gitlab " ]["options " ]["userNamesToIgnore " ] = [];
422
422
} else if (null === $ config ["gitlab " ]["options " ]["userNamesToIgnore " ]) {
@@ -438,7 +438,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
438
438
}
439
439
}
440
440
441
- if (!array_key_exists ( " groupNamesToIgnore " , $ config ["gitlab " ]["options " ])) {
441
+ if (!isset ( $ config ["gitlab " ]["options " ][ " groupNamesToIgnore " ])) {
442
442
$ addProblem ("warning " , "gitlab->options->groupNamesToIgnore missing. (Assuming none.) " );
443
443
$ config ["gitlab " ]["options " ]["groupNamesToIgnore " ] = [];
444
444
} else if (null === $ config ["gitlab " ]["options " ]["groupNamesToIgnore " ]) {
@@ -460,7 +460,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
460
460
}
461
461
}
462
462
463
- if (!array_key_exists ( " createEmptyGroups " , $ config ["gitlab " ]["options " ])) {
463
+ if (!isset ( $ config ["gitlab " ]["options " ][ " createEmptyGroups " ])) {
464
464
$ addProblem ("warning " , "gitlab->options->createEmptyGroups missing. (Assuming false.) " );
465
465
$ config ["gitlab " ]["options " ]["createEmptyGroups " ] = false ;
466
466
} else if (null === $ config ["gitlab " ]["options " ]["createEmptyGroups " ]) {
@@ -470,7 +470,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
470
470
$ addProblem ("error " , "gitlab->options->createEmptyGroups is not a boolean. " );
471
471
}
472
472
473
- if (!array_key_exists ( " deleteExtraGroups " , $ config ["gitlab " ]["options " ])) {
473
+ if (!isset ( $ config ["gitlab " ]["options " ][ " deleteExtraGroups " ])) {
474
474
$ addProblem ("warning " , "gitlab->options->deleteExtraGroups missing. (Assuming false.) " );
475
475
$ config ["gitlab " ]["options " ]["deleteExtraGroups " ] = false ;
476
476
} else if (null === $ config ["gitlab " ]["options " ]["deleteExtraGroups " ]) {
@@ -480,7 +480,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
480
480
$ addProblem ("error " , "gitlab->options->deleteExtraGroups is not a boolean. " );
481
481
}
482
482
483
- if (!array_key_exists ( " newMemberAccessLevel " , $ config ["gitlab " ]["options " ])) {
483
+ if (!isset ( $ config ["gitlab " ]["options " ][ " newMemberAccessLevel " ])) {
484
484
$ addProblem ("warning " , "gitlab->options->newMemberAccessLevel missing. (Assuming 30.) " );
485
485
$ config ["gitlab " ]["options " ]["newMemberAccessLevel " ] = 30 ;
486
486
} else if (null === $ config ["gitlab " ]["options " ]["newMemberAccessLevel " ]) {
@@ -490,7 +490,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
490
490
$ addProblem ("error " , "gitlab->options->newMemberAccessLevel is not an integer. " );
491
491
}
492
492
493
- if (!array_key_exists ( " groupNamesOfAdministrators " , $ config ["gitlab " ]["options " ])) {
493
+ if (!isset ( $ config ["gitlab " ]["options " ][ " groupNamesOfAdministrators " ])) {
494
494
// $addProblem("warning", "gitlab->options->groupNamesOfAdministrators missing. (Assuming none.)");
495
495
$ config ["gitlab " ]["options " ]["groupNamesOfAdministrators " ] = [];
496
496
} else if (null === $ config ["gitlab " ]["options " ]["groupNamesOfAdministrators " ]) {
@@ -512,7 +512,7 @@ private function validateConfig(array &$config, array &$problems = null): bool
512
512
}
513
513
}
514
514
515
- if (!array_key_exists ( " groupNamesOfExternal " , $ config ["gitlab " ]["options " ])) {
515
+ if (!isset ( $ config ["gitlab " ]["options " ][ " groupNamesOfExternal " ])) {
516
516
$ addProblem ("warning " , "gitlab->options->groupNamesOfExternal missing. (Assuming none.) " );
517
517
$ config ["gitlab " ]["options " ]["groupNamesOfExternal " ] = [];
518
518
} else if (null === $ config ["gitlab " ]["options " ]["groupNamesOfExternal " ]) {
@@ -537,17 +537,17 @@ private function validateConfig(array &$config, array &$problems = null): bool
537
537
// >> Gitlab options
538
538
539
539
// << Gitlab instances
540
- if (!array_key_exists ( " instances " , $ config ["gitlab " ]) || !is_array ($ config ["gitlab " ]["instances " ])) {
540
+ if (!isset ( $ config ["gitlab " ][ " instances " ]) || !is_array ($ config ["gitlab " ]["instances " ])) {
541
541
$ addProblem ("error " , "gitlab->instances missing. " );
542
542
} else {
543
543
foreach (array_keys ($ config ["gitlab " ]["instances " ]) as $ instance ) {
544
- if (!array_key_exists ( " url " , $ config ["gitlab " ]["instances " ][$ instance ])) {
544
+ if (!isset ( $ config ["gitlab " ]["instances " ][$ instance][ " url " ])) {
545
545
$ addProblem ("error " , sprintf ("gitlab->instances->%s->url missing. " , $ instance ));
546
546
} else if (!$ config ["gitlab " ]["instances " ][$ instance ]["url " ] = trim ($ config ["gitlab " ]["instances " ][$ instance ]["url " ])) {
547
547
$ addProblem ("error " , sprintf ("gitlab->instances->%s->url not specified. " , $ instance ));
548
548
}
549
549
550
- if (!array_key_exists ( " token " , $ config ["gitlab " ]["instances " ][$ instance ])) {
550
+ if (!isset ( $ config ["gitlab " ]["instances " ][$ instance][ " token " ])) {
551
551
$ addProblem ("error " , sprintf ("gitlab->instances->%s->token missing. " , $ instance ));
552
552
} else if (!$ config ["gitlab " ]["instances " ][$ instance ]["token " ] = trim ($ config ["gitlab " ]["instances " ][$ instance ]["token " ])) {
553
553
$ addProblem ("error " , sprintf ("gitlab->instances->%s->token not specified. " , $ instance ));
0 commit comments