From 174f11c56e1ce36296e49549da357db7022bf25e Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Wed, 27 Sep 2023 07:49:10 +0000 Subject: fixes #3207 Closes #3207 Merge request studip/studip!2174 --- lib/classes/SemType.class.php | 2 +- lib/classes/Seminar.class.php | 4 ++-- lib/language.inc.php | 2 +- lib/models/Course.class.php | 2 +- locale/de/LC_MAILS/new_resource_request.php | 4 ++-- tests/_support/_generated/FunctionalTesterActions.php | 2 +- tests/functional/_bootstrap.php | 18 +++++++++++++++--- tests/functional/lib/models/resources/BuildingTest.php | 2 +- tests/functional/lib/models/resources/LocationTest.php | 2 +- .../lib/models/resources/ResourceAssignmentTest.php | 4 ++-- tests/functional/lib/models/resources/ResourceTest.php | 4 ++-- tests/functional/lib/models/resources/RoomTest.php | 4 ++-- tests/functional/lib/resources/ResourceManagerTest.php | 2 +- 13 files changed, 32 insertions(+), 20 deletions(-) diff --git a/lib/classes/SemType.class.php b/lib/classes/SemType.class.php index 8824406..3d5de5d 100644 --- a/lib/classes/SemType.class.php +++ b/lib/classes/SemType.class.php @@ -108,7 +108,7 @@ class SemType implements ArrayAccess } public function getClass() { - return $GLOBALS['SEM_CLASS'][$this->data['class']] ?: SemClass::getDefaultSemClass(); + return $GLOBALS['SEM_CLASS'][$this->data['class']] ?? SemClass::getDefaultSemClass(); } /*************************************************************************** diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index 6a5903e..b27e2ce 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -307,9 +307,9 @@ class Seminar $cache_key = 'course/undecorated_data/'. $this->id; if ($filter) { - $sub_key = $_SESSION['_language'] .'/'. $this->filterStart .'-'. $this->filterEnd; + $sub_key = ($_SESSION['_language'] ?? 'none') .'/'. $this->filterStart .'-'. $this->filterEnd; } else { - $sub_key = $_SESSION['_language'] .'/unfiltered'; + $sub_key = ($_SESSION['_language'] ?? 'none') .'/unfiltered'; } $data = unserialize($cache->read($cache_key)); diff --git a/lib/language.inc.php b/lib/language.inc.php index 414f80a..acf133b 100644 --- a/lib/language.inc.php +++ b/lib/language.inc.php @@ -194,7 +194,7 @@ function setTempLanguage ($uid = FALSE, $temp_language = "") { */ function restoreLanguage() { global $_language_domain; - setLocaleEnv($_SESSION['_language'] ?: Config::get()->DEFAULT_LANGUAGE, $_language_domain); + setLocaleEnv($_SESSION['_language'] ?? Config::get()->DEFAULT_LANGUAGE, $_language_domain); } /** diff --git a/lib/models/Course.class.php b/lib/models/Course.class.php index 4c471ea..9005373 100644 --- a/lib/models/Course.class.php +++ b/lib/models/Course.class.php @@ -880,7 +880,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe $this->setEndSemester($this->duration_time == -1 ? null : Semester::findByTimestamp($this->start_time + $this->duration_time)); } if ($this->isOpenEnded()) { - $this->start_time = $this->start_time ?: Semester::findCurrent()->beginn; + $this->start_time = $this->start_time ?: Semester::findCurrent()->beginn ?? time(); $this->duration_time = -1; } else { $this->start_time = $this->getStartSemester()->beginn; diff --git a/locale/de/LC_MAILS/new_resource_request.php b/locale/de/LC_MAILS/new_resource_request.php index bca3442..eecac35 100644 --- a/locale/de/LC_MAILS/new_resource_request.php +++ b/locale/de/LC_MAILS/new_resource_request.php @@ -2,9 +2,9 @@ in der Raumverwaltung erstellt. - + Angefragter Raum: - + Angefragte Ressource: diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php index b10769a..1f35fae 100644 --- a/tests/_support/_generated/FunctionalTesterActions.php +++ b/tests/_support/_generated/FunctionalTesterActions.php @@ -1,4 +1,4 @@ - $value) { diff --git a/tests/functional/lib/models/resources/BuildingTest.php b/tests/functional/lib/models/resources/BuildingTest.php index 6576196..17c58a4 100644 --- a/tests/functional/lib/models/resources/BuildingTest.php +++ b/tests/functional/lib/models/resources/BuildingTest.php @@ -49,7 +49,7 @@ class BuildingTest extends \Codeception\Test\Unit \DBManager::getInstance()->setConnection('studip', $this->db_handle); // Workaround old-style Stud.IP-API using $GLOBALS['user'] - $this->oldUser = $GLOBALS['user']; + $this->oldUser = $GLOBALS['user'] ?? null; $GLOBALS['user'] = new \Seminar_User( \User::findByUsername('root@studip') ); diff --git a/tests/functional/lib/models/resources/LocationTest.php b/tests/functional/lib/models/resources/LocationTest.php index a8c4261..f283cab 100644 --- a/tests/functional/lib/models/resources/LocationTest.php +++ b/tests/functional/lib/models/resources/LocationTest.php @@ -50,7 +50,7 @@ class LocationTest extends \Codeception\Test\Unit \DBManager::getInstance()->setConnection('studip', $this->db_handle); // Workaround old-style Stud.IP-API using $GLOBALS['user'] - $this->oldUser = $GLOBALS['user']; + $this->oldUser = $GLOBALS['user'] ?? null; $GLOBALS['user'] = new \Seminar_User( \User::findByUsername('root@studip') ); diff --git a/tests/functional/lib/models/resources/ResourceAssignmentTest.php b/tests/functional/lib/models/resources/ResourceAssignmentTest.php index f2c2fcd..87fbde7 100644 --- a/tests/functional/lib/models/resources/ResourceAssignmentTest.php +++ b/tests/functional/lib/models/resources/ResourceAssignmentTest.php @@ -52,11 +52,11 @@ class ResourceAssignmentTest extends \Codeception\Test\Unit \Config::get()->setValue('LOG_ENABLE', false); // Workaround old-style Stud.IP-API using $GLOBALS['user'] - $this->oldUser = $GLOBALS['user']; + $this->oldUser = $GLOBALS['user'] ?? null; $GLOBALS['user'] = new \Seminar_User( \User::findByUsername('root@studip') ); - $this->oldPerm = $GLOBALS['perm']; + $this->oldPerm = $GLOBALS['perm'] ?? null; $GLOBALS['perm'] = new \Seminar_Perm(); //As a final step we create the SORM objects for our test cases: diff --git a/tests/functional/lib/models/resources/ResourceTest.php b/tests/functional/lib/models/resources/ResourceTest.php index 75a082a..96003d7 100644 --- a/tests/functional/lib/models/resources/ResourceTest.php +++ b/tests/functional/lib/models/resources/ResourceTest.php @@ -46,11 +46,11 @@ class ResourceTest extends \Codeception\Test\Unit \DBManager::getInstance()->setConnection('studip', $this->db_handle); // Workaround old-style Stud.IP-API using $GLOBALS['user'] - $this->oldUser = $GLOBALS['user']; + $this->oldUser = $GLOBALS['user'] ?? null; $GLOBALS['user'] = new \Seminar_User( \User::findByUsername('root@studip') ); - $this->oldPerm = $GLOBALS['perm']; + $this->oldPerm = $GLOBALS['perm'] ?? null; $GLOBALS['perm'] = new \Seminar_Perm(); //As a final step we create the SORM objects for our test cases: diff --git a/tests/functional/lib/models/resources/RoomTest.php b/tests/functional/lib/models/resources/RoomTest.php index 82611f2..8dd30a4 100644 --- a/tests/functional/lib/models/resources/RoomTest.php +++ b/tests/functional/lib/models/resources/RoomTest.php @@ -61,11 +61,11 @@ class RoomTest extends \Codeception\Test\Unit \DBManager::getInstance()->setConnection('studip', $this->db_handle); // Workaround old-style Stud.IP-API using $GLOBALS['user'] - $this->oldUser = $GLOBALS['user']; + $this->oldUser = $GLOBALS['user'] ?? null; $GLOBALS['user'] = new \Seminar_User( \User::findByUsername('root@studip') ); - $this->oldPerm = $GLOBALS['perm']; + $this->oldPerm = $GLOBALS['perm'] ?? null; $GLOBALS['perm'] = new \Seminar_Perm(); //As a final step we create the SORM objects for our test cases: diff --git a/tests/functional/lib/resources/ResourceManagerTest.php b/tests/functional/lib/resources/ResourceManagerTest.php index f858e90..49e585a 100644 --- a/tests/functional/lib/resources/ResourceManagerTest.php +++ b/tests/functional/lib/resources/ResourceManagerTest.php @@ -31,7 +31,7 @@ class ResourceManagerTest extends \Codeception\Test\Unit \DBManager::getInstance()->setConnection('studip', $this->db_handle); // Workaround old-style Stud.IP-API using $GLOBALS['user'] - $this->oldUser = $GLOBALS['user']; + $this->oldUser = $GLOBALS['user'] ?? null; $GLOBALS['user'] = new \Seminar_User( \User::findByUsername('root@studip') ); -- cgit v1.0