nextcloud / bookmarks

🔖 Bookmark app for Nextcloud
https://apps.nextcloud.com/apps/bookmarks
GNU Affero General Public License v3.0
1.01k stars 173 forks source link

TypeError: Argument 3 passed to MiddlewareDispatcher::beforeOutput() must be of the type string, null given, called in ....Http/Dispatcher.php on line 123 #1154

Open radoeka opened 4 years ago

radoeka commented 4 years ago

Describe the bug When visiting the bookmarks section, the following error is reported in Nextcloud.log:

TypeError: Argument 3 passed to OC\AppFramework\Middleware\MiddlewareDispatcher::beforeOutput() must be of the type string, null given, called in ....nextcloud-18.0.7/lib/private/AppFramework/Http/Dispatcher.php on line 123

To Reproduce Steps to reproduce the behavior:

  1. Go to 'settings/admin/logging' in one tab (Firefox)
  2. Go to 'apps/bookmarks' in another tab (Chrome)
  3. See error in the logging

Expected behavior No error in the log file

Screenshots Not applicable

Desktop (please complete the following information):

Server (please complete the following information):

Enabled:

Additional context

Web server error log

Insert your webserver log here

Nextcloud log (nextcloud/data/nextcloud.log)


TypeError: Argument 3 passed to OC\AppFramework\Middleware\MiddlewareDispatcher::beforeOutput() must be of the type string, null given, called in /srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/lib/private/AppFramework/Http/Dispatcher.php on line 123

/srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/lib/private/AppFramework/Http/Dispatcher.php - line 123:
OC\AppFramework\Middleware\MiddlewareDispatcher->beforeOutput()

/srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/lib/private/AppFramework/App.php - line 125:
OC\AppFramework\Http\Dispatcher->dispatch()

/srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:
OC\AppFramework\App::main()

<<closure>>
OC\AppFramework\Routing\RouteActionHandler->__invoke()

/srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/lib/private/Route/Router.php - line 299:
call_user_func()

/srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/lib/base.php - line 1008:
OC\Route\Router->match()

/srv/www/vhosts/owncloud.radoeka.nl/nextcloud-18.0.7/index.php - line 38:
OC::handleRequest()```
radoeka commented 4 years ago

Upgraded in the meantime to NC-19.0.1, the problem still happens. It looks like only for the pages/calls that involve a tag. Thus not for the 'All bookmarks' nor for the 'Recent bookmarks'. The others result in the error message (for a tag with one instance, only once for tags with multiple instances (more than 1) multiple times, looks to be limited to 4).

TypeError: Argument 3 passed to OC\AppFramework\Middleware\MiddlewareDispatcher::beforeOutput() must be of the type string, null given, called in <path>/nextcloud-19.0.1/lib/private/AppFramework/Http/Dispatcher.php on line 124

    <path>/nextcloud-19.0.1/lib/private/AppFramework/Http/Dispatcher.php - line 124:
    OC\AppFramework\Middleware\MiddlewareDispatcher->beforeOutput()

    <path>/nextcloud-19.0.1/lib/private/AppFramework/App.php - line 137:
    OC\AppFramework\Http\Dispatcher->dispatch()

    <path>/nextcloud-19.0.1/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:
    OC\AppFramework\App::main()

    <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke()

    <path>/nextcloud-19.0.1/lib/private/Route/Router.php - line 297:
    call_user_func()

    <path>/nextcloud-19.0.1/lib/base.php - line 1007:
    OC\Route\Router->match()

    <path>/nextcloud-19.0.1/index.php - line 37:
    OC::handleRequest()
radoeka commented 4 years ago

Could it be the difference in the GET url? The difference for both is:

GET /apps/bookmarks/bookmark?limit=42&page=0&sortby=added HTTP/1.1" 200 13532
GET /apps/bookmarks/bookmark?limit=42&page=0&sortby=added&tags[]=linux&conjunction=and HTTP/1.1" 200 8503
GET /apps/bookmarks/bookmark?limit=42&page=0&sortby=added&tags[]=openSUSE&conjunction=and HTTP/1.1" 200 4375
GET /apps/bookmarks/bookmark?limit=42&page=0&sortby=added HTTP/1.1" 200 13532

Could the "&tags[]=linux&conjunction=and" be the issue?

radoeka commented 4 years ago

Hmm, changed to alphabetical order (from most recent), and the now error pops up in all cases... /confused.

marcelklehr commented 4 years ago

Could you try to find out for which URLs the error happens? I think this once happened for favicon routes, so this may be a regression.

radoeka commented 4 years ago

Yep, looks related to favicons:

/var/log/apache2 # grep 22:08:24 access_log | cut -c20-
[16/Aug/2020:22:08:24 +0200] "GET /apps/logreader/poll?lastReqId=uqCxiiqFuOcQIelrn6My HTTP/1.1" 200 4095
[16/Aug/2020:22:08:24 +0200] "GET /apps/bookmarks/bookmark/259/favicon HTTP/1.1" 303 -
[16/Aug/2020:22:08:24 +0200] "GET /apps/bookmarks/bookmark/233/favicon HTTP/1.1" 303 -
[16/Aug/2020:22:08:24 +0200] "GET /apps/bookmarks/bookmark/37/favicon HTTP/1.1" 303 -
[16/Aug/2020:22:08:24 +0200] "GET /apps/bookmarks/bookmark/601/favicon HTTP/1.1" 303 -
[16/Aug/2020:22:08:24 +0200] "GET /apps/bookmarks/bookmark/510/favicon HTTP/1.1" 303 -

The error is reported for all bookmark queries. When I grep for the error time, often favicons requests are showing up and hardly any other links.