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

"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a1a8c2e96d44_386c11aa095916@gitlab-sidekiq-low-urgency-cpu-bound-v2-985c55b68-klkgb.mail>

MAGENE Sem Joel pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
f5e520ee by MAGENE Sem Joel at 2026-05-30T06:58:34+00:00
[BP][FIX] Calendar: fix undefined session-key warnings and null-description deprecations
---
* [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

(cherry picked from commit c45c8afba920f505dbad3c688514929cc5776db1)

See merge request tikiwiki/tiki!10410

- - - - -


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]);
@@ -893,6 +896,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
=====================================
@@ -115,6 +115,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':
@@ -166,14 +171,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/f5e520ee39398f0c67c32bb37fa3482b988f49f9

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f5e520ee39398f0c67c32bb37fa3482b988f49f9
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.