Skip to content

Calendar crashes on PHP 8.4 and breaks other apps #8237

@oreds

Description

@oreds

Steps to reproduce

  1. Install Nextcloud 33.0.2 with Calendar 6.2.3 and PHP 8.4
  2. Open Calendar OR any other app (e.g. Mail, Analytics)
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions