-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Bug Report: RefreshWebcalService "Attempt to read property UID on null"
Title
[Bug]: RefreshWebcalService: "Attempt to read property UID on null" when webcal contains entries without base component
Description
During cron execution, RefreshWebcalService.php throws an error when processing webcal subscriptions that contain calendar entries where getBaseComponent() returns null.
Error Details
Error Message:
Attempt to read property "UID" on null at apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php#81
Affected Code (lines 79-81):
$vBase = $vObject->getBaseComponent();
if (!$vBase->UID) {Problem Analysis
The method getBaseComponent() can return null for calendar entries that only contain VTIMEZONE components or have malformed calendar data. However, the code attempts to access the UID property without first checking if $vBase is null, resulting in the error.
Suggested Fix
Add a null check before accessing the UID property:
$vBase = $vObject->getBaseComponent();
if (!$vBase || !$vBase->UID) {This ensures the code handles cases where getBaseComponent() returns null gracefully.
Environment
Nextcloud version: 32.0.5.0
Operating System: Debian GNU/Linux 12 (bookworm)
Architecture: aarch64 (Raspberry Pi 5)
Web server: Apache/2.4.65 (Debian)
PHP version: 8.2.29
Database: MySQL
Log Sample
The error occurs repeatedly during cron execution (every ~20 minutes):
{
"reqId": "b8xnjjHYzxO9IPMRfkqV",
"level": 2,
"time": "2026-01-22T08:10:05+00:00",
"remoteAddr": "",
"user": "--",
"app": "PHP",
"method": "",
"url": "--",
"scriptName": "/var/www/nextcloud-data/nextcloud/cron.php",
"message": "Attempt to read property \"UID\" on null at /var/www/nextcloud-data/nextcloud/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php#81",
"userAgent": "--",
"version": "32.0.5.0",
"occ_command": ["/var/www/nextcloud-data/nextcloud/cron.php"],
"data": {"app": "PHP"}
}Impact
- Severity: Warning (level 2)
- Frequency: Recurring every cron cycle when affected webcal subscriptions are refreshed
- User Impact: Error fills logs but does not prevent functionality due to the
continuestatement that follows - Workaround: Errors can be ignored as they are warnings, not fatal errors. The continue logic handles the situation gracefully once it gets past the error.
Steps to Reproduce
- Subscribe to a webcal calendar that contains entries with only VTIMEZONE components or malformed data where
getBaseComponent()returns null - Wait for cron to execute the RefreshWebcalJob
- Check Nextcloud logs for the error message
Related Code
- File:
apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php - Line: 81
- Source: https://github.com/nextcloud/server/blob/master/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php
Additional Notes
This is a null pointer safety issue that should be addressed to prevent log pollution and ensure robust handling of edge cases in calendar data.