From 7d981283a8e05db33be4d56ea4d2df69434a6952 Mon Sep 17 00:00:00 2001 From: jheim2 Date: Thu, 29 Aug 2024 12:05:04 +0200 Subject: [PATCH] Fix PHP crash when copying course with OnlyOffice objects Set $title to an empty string if the "upload_files" key is missing from the `$_POST` array, preventing the PHP script from crashing when copying a course with OnlyOffice objects. --- classes/class.ilObjOnlyOffice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/class.ilObjOnlyOffice.php b/classes/class.ilObjOnlyOffice.php index 90f47788..9016156a 100755 --- a/classes/class.ilObjOnlyOffice.php +++ b/classes/class.ilObjOnlyOffice.php @@ -76,7 +76,7 @@ public function doCreate(bool $clone_mode = false): void $end_time = $_POST[ilObjOnlyOfficeGUI::POST_VAR_EDIT_LIMITED_END]; if ($title == null) { - $title = explode('.', $_POST[ilObjOnlyOfficeGUI::POST_VAR_FILE]['name'])[0]; + $title = isset($_POST[ilObjOnlyOfficeGUI::POST_VAR_FILE]['name']) ? $_POST[ilObjOnlyOfficeGUI::POST_VAR_FILE]['name'] : ''; $_POST['title'] = $title; } @@ -182,4 +182,4 @@ public function isAllowedEdit(): bool { return $this->object_settings->allowEdit(); } -} \ No newline at end of file +}