nextcloud / nextcloud/groupfolders

PHP 8 crash in GroupFolders trashbin when item has no extension (Undefined array key "extension")

Open
#4,359 6 comments 0 reactions 1 assignee View on GitHub

@provokateurin is already working on this.

Since Feb 8, 2026.

1. to develop bug
Dominant language
PHP
Stars
343
Forks
106
Avg merge
2d 3h
Merged PRs (30d)
34

Description

Steps to reproduce
  1. Create a Group Folder (Team folder)
  2. Inside the Group Folder:
    • Create a directory or a file without extension (e.g. README)
  3. Delete the directory / file
  4. Open the Trashbin via web UI or via WebDAV (PROPFIND on /remote.php/dav/trashbin/*)
Expected behaviour

Group Folder trashbin should open normally and list all deleted items,
including directories and files without extensions.

Actual behaviour

The Group Folder trashbin fails to load and returns a PHP fatal error
when the trash contains directories or files without an extension.

Server configuration

Operating system: Linux
Web server: Apache
Database: PostgreSQL
PHP version: PHP 8.3
Nextcloud version: 32.0.5
Team folders version: groupfolders (shipped / custom_apps)
Updated from an older Nextcloud/ownCloud or fresh install: fresh install
Where did you install Nextcloud from: official Nextcloud package
Are you using external storage, if yes which one: local
Are you using encryption: no
Are you using an external user-backend, if yes which one: no

Client configuration

Browser: any (also reproducible via WebDAV)
Operating system: Linux

Logs
Web server error log
Web server error log PHP Notice: Undefined array key "extension" in custom_apps/groupfolders/lib/Trash/TrashBackend.php on line ~451

PHP Fatal error: Uncaught TypeError:
substr(): Argument #1 ($string) must be of type string, null given

Nextcloud log (data/nextcloud.log)
Nextcloud log

Error during WebDAV PROPFIND /remote.php/dav/trashbin/*

Undefined array key "extension"
substr(): Argument #1 ($string) must be of type string, null given

Stack trace points to:
custom_apps/groupfolders/lib/Trash/TrashBackend.php:~451

Browser log
Browser log

PROPFIND /remote.php/dav/trashbin/* → 500 Internal Server Error

Additional information
  • The issue only occurs when the Group Folder trash contains:
    • directories (mimetype = httpd/unix-directory), or
    • files without a file extension
  • Database integrity is OK (no NULL values in name, original_location, or file_id)
  • Removing folder entries from oc_group_folders_trash immediately resolves the issue
  • Root cause appears to be assuming pathinfo()['extension'] always exists
  • pathinfo() does not return an extension key for directories or filenames without a dot
  • This leads to a PHP 8 fatal error when the value is later passed to substr()

A small defensive fix using $pathInfo['extension'] ?? '' and
$pathInfo['filename'] prevents the crash without changing behavior
for files that do have extensions.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.