From f822f8b1866b0c4fab345dcbe9db65053690f109 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Oct 2023 17:09:18 +0000 Subject: [PATCH] =?UTF-8?q?More=20graceful=20failure=20if=20ldap=5Fresults?= =?UTF-8?q?=20JSON=20decode=20isn=E2=80=99t=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- app/Http/Controllers/Users/LDAPImportController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Users/LDAPImportController.php b/app/Http/Controllers/Users/LDAPImportController.php index 88a6b207df..b86be03d99 100644 --- a/app/Http/Controllers/Users/LDAPImportController.php +++ b/app/Http/Controllers/Users/LDAPImportController.php @@ -56,6 +56,10 @@ class LDAPImportController extends Controller $ldap_results_json = Artisan::output(); $ldap_results = json_decode($ldap_results_json, true); + if (!$ldap_results) { + return redirect()->back()->withInput()->with('error', trans('general.no_results')); + } + // Direct user to appropriate status page. if ($ldap_results['error']) { return redirect()->back()->withInput()->with('error', $ldap_results['error_message']);