nextcloud / nextcloud/server

App framework: build lazy service listeners from app container, not server container

Open
#27,793 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 26-feedback bug integration technical debt
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.
Steps to reproduce
  1. Register an app listener in the bootstrap logic of your app
  2. Use a custom parameter, service or alias in for the constructor injection of the listener
Expected behavior

DI resolves the arguments, the listener is built and executed.

Actual behavior

💥 https://help.nextcloud.com/t/app-development-getting-exception-on-event/119418

The problem is that https://github.com/nextcloud/server/blob/master/lib/private/EventDispatcher/ServiceEventListener.php asks the server container for the service, not the respective app container.

Server configuration

Nextcloud version: Any that supports the lazy event listeners

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 with lib/private/EventDispatcher/ServiceEventListener.php and trace how a listener registered during app bootstrap is constructed. Reproduce the issue with a custom parameter, service, or alias in the listener constructor. Done means dependency injection resolves those arguments and the listener is built and executed using the app container.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.