Issue Bug Closed

#109960Filelist tree search crashes for non-admin users with a sub-folder file mount (null deref in TreeController::filterDataAction)

Aristeidis Karavas 06/02/26, 07:29 updated 08/11/26, 08:50

Description

**Problem**
In the Filelist (“Medien”) module, using the folder-tree search field throws an uncaught error for non-admin backend users whose file mount is a sub-folder (e.g. `1:/user_upload/`) rather than the storage root. The AJAX call filestorage/tree/filterData returns HTTP 500:

Error: Call to a member function getCombinedIdentifier() on null
in .../backend/Classes/Controller/FileStorage/TreeController.php line 132

The frontend then reports “Error loading the navigation – Unexpected response from server”, and the module falls back to the storage root `1:/`, which the user may not access (“missing folder permissions”).

Steps to reproduce
  1. Create a non-admin BE user/group with a file mount on a sub-folder, e.g. `1:/user_upload/`.
  2. Log in as that user, open the Filelist module.
  3. Type any term into the tree search field that matches a folder.
  4. -> 500 / “Unexpected response from server”.

Admins are unaffected (their effective root is the storage root, so the loop terminates normally).

**Cause**
In TreeController::filterDataAction() the rootline walk-up loop dereferences $nextFolder after it can become null:

do {
  $itemsInRootLine[$nextFolder->getCombinedIdentifier()] = ...;   // line 132
  try { $nextFolder = $nextFolder->getParentFolder(); }
    catch (InsufficientFolderAccessPermissionsException) { $nextFolder = null; }
} while ($nextFolder?->getIdentifier() !== '/');

When the walk reaches the file-mount boundary, getParentFolder() throws, $nextFolder becomes null, but null?->getIdentifier() !== '/' is true, so the loop re-enters and calls getCombinedIdentifier()` on null.

**Regression**
This is a v14 regression. In v12.4 and v13.4 the loop condition was

} while ($nextFolder instanceof Folder && $nextFolder->getIdentifier() !== '/');

which correctly stops on null. It was changed to the null-safe ?-> form in v14, which altered the termination semantics. Still present in main.

**Suggested fix**
Restore the null guard:

} while ($nextFolder instanceof Folder && $nextFolder->getIdentifier() !== '/');

Affected versions: 14.x and main (12.4 / 13.4 not affected).

Reviews 2

Files 1

History 36

  1. Andreas Kienast commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-06-02T19:20:10+00:00" > 06/02/26, 19:20 </span>

    Applied in changeset commit:5e3fc857b11c8f716df6ee7c4d28e574104f3711.