[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Calendar: fix undefined session-key warnings and null-description deprecations

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a1a07a61f1b1_38193a8435213@gitlab-sidekiq-low-urgency-cpu-bound-v2-985c55b68-wdwg9.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
c45c8afb by MAGENE Sem Joel at 2026-05-29T21:22:49+00:00
[FIX] Calendar: fix undefined session-key warnings and null-description deprecations
---
* [FIX] Calendar: fix undefined session-key warnings and null-description deprecations

See merge request tikiwiki/tiki!10406

- - - - -


3 changed files:

- lib/calendar/calendarlib.php
- lib/wiki-plugins/wikiplugin_calendar.php
- modules/mod-func-calendar_new.php


Changes:

=====================================
lib/calendar/calendarlib.php
=====================================
@@ -707,6 +707,9 @@ class CalendarLib extends TikiLib
         $res = $result->fetchRow();
 
         if ($res) {
+            if ($res['description'] === null) {
+                $res['description'] = '';
+            }
             $query
                 = "select `username`, `role`, `partstat`, `comment` from `tiki_calendar_roles` where `calitemId`=? order by `role`";
             $rezult = $this->query($query, [(int)$calitemId]);
@@ -895,6 +898,10 @@ class CalendarLib extends TikiLib
         }
 
         $data['user'] = $user;
+        // Enforce calendar-item invariant: description is always a string.
+        if (! array_key_exists('description', $data) || $data['description'] === null) {
+            $data['description'] = '';
+        }
 
         $realcolumns = ['calitemId', 'calendarId', 'start', 'end', 'locationId', 'categoryId', 'nlId', 'priority', 'uri', 'uid',
                      'status', 'url', 'lang', 'name', 'description', 'user', 'created', 'lastmodif', 'allday', 'recurrenceId', 'changed', 'recurrenceStart', 'hideParticipants'];


=====================================
lib/wiki-plugins/wikiplugin_calendar.php
=====================================
@@ -117,6 +117,11 @@ function wikiplugin_calendar($data, $params)
         'view_calendar'
     );
 
+    if (empty($rawcals['data'])) {
+        Feedback::error(tra("You do not have permission to view the calendar"));
+        return;
+    }
+
     $focusdate = date("Y-m-d");
     switch ($params['viewmode']) {
         case 'week':
@@ -168,14 +173,15 @@ function wikiplugin_calendar($data, $params)
     }
 
     $checkedCalIds = [];
-    if (is_array($_SESSION['PluginCalendarViewGroups'])) {
+    $pluginCalendarViewGroups = $_SESSION['PluginCalendarViewGroups'] ?? null;
+    if (is_array($pluginCalendarViewGroups)) {
         foreach ($calendars as $calendarId => $calendar) {
-            if (in_array($calendarId, $_SESSION['PluginCalendarViewGroups'])) {
+            if (in_array($calendarId, $pluginCalendarViewGroups)) {
                 $checkedCalIds[] = $calendarId;
             }
         }
-        $displayedcals = $_SESSION['PluginCalendarViewGroups'];
-        $pluginCalendarIds = implode(',', $_SESSION['PluginCalendarViewGroups']);
+        $displayedcals = $pluginCalendarViewGroups;
+        $pluginCalendarIds = implode(',', $pluginCalendarViewGroups);
     } else {
         $displayedcals = $params['calIds'];
         $checkedCalIds = $params['calIds'];


=====================================
modules/mod-func-calendar_new.php
=====================================
@@ -211,14 +211,15 @@ function module_calendar_new($mod_reference, $module_params)
         }
 
         $checkedCalIds = [];
-        if (is_array($_SESSION['ModuleCalendarViewGroups'])) {
+        $moduleCalendarViewGroups = $_SESSION['ModuleCalendarViewGroups'] ?? null;
+        if (is_array($moduleCalendarViewGroups)) {
             foreach ($calendars as $calendarId => $calendar) {
-                if (in_array($calendarId, $_SESSION['ModuleCalendarViewGroups'])) {
+                if (in_array($calendarId, $moduleCalendarViewGroups)) {
                     $checkedCalIds[] = $calendarId;
                 }
             }
-            $displayedcals = $_SESSION['ModuleCalendarViewGroups'];
-            $moduleCalendarIds = implode(',', $_SESSION['ModuleCalendarViewGroups']);
+            $displayedcals = $moduleCalendarViewGroups;
+            $moduleCalendarIds = implode(',', $moduleCalendarViewGroups);
         } else {
             $displayedcals = $calIds;
             $checkedCalIds = $calIds;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c45c8afba920f505dbad3c688514929cc5776db1

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c45c8afba920f505dbad3c688514929cc5776db1
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.