opnsense / opnsense/plugins

NextCloud Backup plugin throws exception on save/setup/apply

Open Beginner friendly
#5,574 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
863
Avg merge
2d 6h
Merged PRs (30d)
10

Description

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug
Configuring the plugin via OPNsense WebGUI results in an exception if the relative path option uses subfolders like foo/bar

To Reproduce
Steps to reproduce the behavior:

  1. Install plugin
  2. Go to System → Configuration → Backups → and fill in NextCloud Backup options
  3. press save
  4. see error

Expected behavior

  • no exception
  • a user friendly failure description or successful message "backup tested successfully"

Screenshots

Relevant log files

Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /usr/local/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php:612 Stack trace: #0 /usr/local/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php(477): OPNsense\Backup\Nextcloud->create_directory('https://files.domain.at...', 'nextcloud-username...', 'passwor...', 'nextcloud-username...', 'OPNsense-Backup...') #1 /usr/local/www/diag_backup.php(395): OPNsense\Backup\Nextcloud->backup() #2 {main} thrown in /usr/local/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php on line 612

Additional context
I figured out, that if the directory name of the field " Directory Name without leading slash, starting from user's root" is just a word like "OPNsense", the backup works like expected.

Environment
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
FreeBSD 15.1-RELEASE-p1 stable/26.7-n283674-12334a596709 SMP amd64
OPNsense 26.7.1 aba53112d
Plugins os-acme-client-4.16_1 os-git-backup-1.1_3 os-nextcloud-backup-1.2 os-nginx-1.36_3 os-ntopng-1.3 os-postfix-1.24.1 os-redis-1.1_4 os-rspamd-1.13_2
Time Tue, 21 Jul 2026 22:18:28 +0200
OpenSSL 3.5.7
Python 3.13.14
PHP 8.5.8


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in /usr/local/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php, especially create_directory() around line 612 and its call around line 477. Reproduce the backup setup with a relative directory such as foo/bar, then verify that saving no longer throws an exception and instead reports a successful test or user-friendly failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.