App framework: build lazy service listeners from app container, not server container
Nobody has claimed this yet.
- 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
- Register an app listener in the bootstrap logic of your app
- 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
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 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