Steps to reproduce
- Install Nextcloud 33.0.2 with Calendar 6.2.3 and PHP 8.4
- Open Calendar OR any other app (e.g. Mail, Analytics)
- Navigate to /apps/calendar or /apps/mail
Expected behavior
Calendar should load normally and other apps (Mail, Analytics) should work without errors.
Actual behavior
HTTP 500 error occurs.
Error in log:
TypeError: array_intersect(): Argument #1 ($array) must be of type array, null given
Calendar app version
6.2.3
CalDAV-clients used
iPhone (iOS), Thunderbird (CalDAV)
Browser
Firefox 150
Client operating system
Windows 11
Server operating system
Linux
Web server
Apache
Database engine version
MariaDB
PHP engine version
PHP 8.4
Nextcloud version
33.0.2
Updated from an older installed version or fresh install
None
List of activated apps
calendar, mail, analytics, contacts, dav (and default apps)
Nextcloud configuration
Docker (nextcloud), MariaDB, Redis
Reverse proxy (Apache)
Web server error log
Log file
TypeError: array_intersect(): Argument #1 ($array) must be of type array, null given in custom_apps/calendar/lib/Service/CalendarInitialStateService.php line 173 Triggered when opening Calendar and also affects other apps (Mail, Analytics)
Browser log
Additional info
The issue can be reproduced consistently on PHP 8.4.
Root cause appears to be missing null checks in:
custom_apps/calendar/lib/Service/CalendarInitialStateService.php
Problematic lines:
array_intersect($startConversation, $userGroups)
array_intersect($allowedGroups, $userGroups)
If either variable is null, PHP 8.4 throws:
TypeError: array_intersect(): Argument #1 ($array) must be of type array, null given
Temporary workaround:
array_intersect($startConversation ?? [], $userGroups ?? [])
array_intersect($allowedGroups ?? [], $userGroups ?? [])
Applied via:
sed -i 's/array_intersect($startConversation, $userGroups)/array_intersect($startConversation ?? [], $userGroups ?? [])/' /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php
sed -i 's/array_intersect($allowedGroups, $userGroups)/array_intersect($allowedGroups ?? [], $userGroups ?? [])/' /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php
After applying this patch and restarting the container, all affected apps (Calendar, Mail, Analytics) work correctly.
Steps to reproduce
Expected behavior
Calendar should load normally and other apps (Mail, Analytics) should work without errors.
Actual behavior
HTTP 500 error occurs.
Error in log:
TypeError: array_intersect(): Argument #1 ($array) must be of type array, null given
Calendar app version
6.2.3
CalDAV-clients used
iPhone (iOS), Thunderbird (CalDAV)
Browser
Firefox 150
Client operating system
Windows 11
Server operating system
Linux
Web server
Apache
Database engine version
MariaDB
PHP engine version
PHP 8.4
Nextcloud version
33.0.2
Updated from an older installed version or fresh install
None
List of activated apps
Nextcloud configuration
Web server error log
Log file
Browser log
Additional info
The issue can be reproduced consistently on PHP 8.4.
Root cause appears to be missing null checks in:
custom_apps/calendar/lib/Service/CalendarInitialStateService.php
Problematic lines:
array_intersect($startConversation, $userGroups)
array_intersect($allowedGroups, $userGroups)
If either variable is null, PHP 8.4 throws:
TypeError: array_intersect(): Argument #1 ($array) must be of type array, null given
Temporary workaround:
array_intersect($startConversation ?? [], $userGroups ?? [])
array_intersect($allowedGroups ?? [], $userGroups ?? [])
Applied via:
sed -i 's/array_intersect($startConversation, $userGroups)/array_intersect($startConversation ?? [], $userGroups ?? [])/' /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php
sed -i 's/array_intersect($allowedGroups, $userGroups)/array_intersect($allowedGroups ?? [], $userGroups ?? [])/' /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php
After applying this patch and restarting the container, all affected apps (Calendar, Mail, Analytics) work correctly.