diff --git a/app/Http/Controllers/DiagnosticsController.php b/app/Http/Controllers/DiagnosticsController.php index 28dfaffb0c..5868f7c9e5 100644 --- a/app/Http/Controllers/DiagnosticsController.php +++ b/app/Http/Controllers/DiagnosticsController.php @@ -249,8 +249,10 @@ public function get_config() // Load settings $settings = $this->configFunctions->min_info(); foreach ($settings as $key => $value) { - if (!is_array($value)) { + if (!is_array($value) && !is_null($value)) { $configs[] = $this->line($key . ':', $value); + } elseif (is_null($value)) { + $configs[] = 'Error: ' . $key . ' has a NULL value!'; } } } catch (QueryException $e) { diff --git a/database/migrations/2018_08_10_134924_move_settings.php b/database/migrations/2018_08_10_134924_move_settings.php index fd5c139fc3..dffd16c4c7 100644 --- a/database/migrations/2018_08_10_134924_move_settings.php +++ b/database/migrations/2018_08_10_134924_move_settings.php @@ -58,8 +58,7 @@ public function up() Configs::where('key', '=', $result->key . '_col')->update(['value' => $order_by[2] ?? 'id']); Configs::where('key', '=', $result->key . '_order')->update(['value' => $order_by[3] ?? 'DESC']); } elseif (!in_array($result->key, ['checkForUpdates', 'hide_version_number', 'identifier', 'php_script_limit', 'plugins', 'public_search', 'useExiftool', 'version'])) { - Configs::where('key', '=', $result->key)->update(['value' => $result->value]); - Logs::notice(__FUNCTION__, __LINE__, env('DB_OLD_LYCHEE_PREFIX', '') . 'lychee_settings does not exist!'); + Configs::where('key', '=', $result->key)->update(['value' => $result->value ?? '']); } } } else { diff --git a/tests/Feature/DiagnosticsTest.php b/tests/Feature/DiagnosticsTest.php index 9d0a8180bb..72d8564688 100644 --- a/tests/Feature/DiagnosticsTest.php +++ b/tests/Feature/DiagnosticsTest.php @@ -4,6 +4,7 @@ namespace Tests\Feature; +use App\Configs; use Tests\Feature\Lib\SessionUnitTest; use Tests\TestCase; @@ -25,12 +26,16 @@ public function test_diagnostics() $response = $this->get('/Diagnostics'); $response->assertStatus(200); // code 200 something + Configs::where('key', '=', 'lossless_optimization')->update(['value' => null]); + $response = $this->post('/api/Diagnostics'); $response->assertStatus(200); // code 200 something too $response = $this->post('/api/Diagnostics::getSize'); $response->assertStatus(200); // code 200 something too + Configs::where('key', '=', 'lossless_optimization')->update(['value' => '1']); + $session_tests->logout($this); } }