NextCloud Backup plugin throws exception on save/setup/apply
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:
- I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- I have searched the existing issues, open and closed, and I'm convinced that mine is new.
- The title contains the plugin to which this issue belongs
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:
- Install plugin
- Go to System → Configuration → Backups → and fill in NextCloud Backup options
- press save
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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