Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Argument 14 passed to OCA\Music\Controller\ApiController::__construct() must implement #682

Closed
cdamken opened this issue Feb 7, 2019 · 3 comments

Comments

@cdamken
Copy link

cdamken commented Feb 7, 2019

app
index
browser
Chrome 71.0.3578
browser.name
Chrome
level
error
logger
php
oc-loglevel
3
os.name
Windows 10
release
10.1.0.4
runtime
php 7.0.32
runtime.name
php
transaction
/apps/music/api/album/116082/cover
url
https://cloud.damken.com/index.php/apps/music/api/album/116082/cover

EXCEPTION(most recent call first)
TypeError: Argument 14 passed to OCA\Music\Controller\ApiController::__construct() must implement interface OCP\Files\Folder, null given, called in /var/www/owncloud/apps/music/app/music.php on line 103
#8 music/controller/apicontroller.php(70): __construct
#7 music/app/music.php(103): OCA\Music\App\{closure}
#6 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): offsetGet
#5 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): query
#4 /var/www/owncloud/lib/private/AppFramework/App.php(77): main
#3 /var/www/owncloud/lib/private/AppFramework/Routing/RouteActionHandler.php(46): __invoke
#2 /var/www/owncloud/lib/private/Route/Router.php(342): match
#1 /var/www/owncloud/lib/base.php(909): handleRequest
#0 /var/www/owncloud/index.php(54): null
@paulijar
Copy link
Collaborator

@cdamken Can you give any more information about this problem? What were you doing when this occurred? Did this happen once or every time you do the same thing?

@paulijar
Copy link
Collaborator

I have observed this kind of exception traces when there's no logged in user while some Music app REST endpoint is called. In this case, null is passed to ApiController constructor instead of the user folder reference, and this triggers the TypeError.

In the reported case, the error has occurred while loading an album cover. A possible explanation could be that one browser tab was in the process of loading the albums view while the user logged off from another tab. If this has been the case, then there's probably nothing we could or should do within the Music app.

@paulijar
Copy link
Collaborator

With no further information about the steps leading to this exception, there's no way to investigate this further. Closing.

paulijar added a commit to paulijar/music that referenced this issue May 9, 2020
In case there is no logged in user, the ApiController constructor may
get called with $userFolder value null. This used to cause an
exception since the null didn't match the type hint "Folder".

The cloud core has a logic to redirect the user to the login page if
service requiring login is queried without a valid session. However,
this type mismatch exception apparently fired before that logic had a
chance to kick in.

This problem was probably also behind the report owncloud#682.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants