From 12dd47731290bf539be7a2a81571f8ada223e9c4 Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Tue, 30 Jan 2024 18:24:28 +0100 Subject: [PATCH] fix(legacy): avoid crash when lot of streams in configuration (#2915) ### Description lot of streams forbid http://libretime.example.org/preference/stream-setting to open (max=4) this patch prevent the crash by displaying an error message and truncate streamcount to 4. Co-authored-by: Kyle Robbertze --- legacy/application/controllers/PreferenceController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/legacy/application/controllers/PreferenceController.php b/legacy/application/controllers/PreferenceController.php index 3b2f0c530..1351343e6 100644 --- a/legacy/application/controllers/PreferenceController.php +++ b/legacy/application/controllers/PreferenceController.php @@ -156,6 +156,11 @@ class PreferenceController extends Zend_Controller_Action $setting = Application_Model_StreamSetting::getStreamSetting(); $form->setSetting($setting); + if ($num_of_stream > MAX_NUM_STREAMS) { + Logging::error('Your streams count (' . $num_of_stream . ') exceed the maximum, some of them will not be displayed'); + $num_of_stream = MAX_NUM_STREAMS; + } + for ($i = 1; $i <= $num_of_stream; ++$i) { $subform = new Application_Form_StreamSettingSubForm(); $subform->setPrefix($i);