nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.37k stars 4.07k forks source link

[Bug]: Syntax error in L10NString.php Line 88 #34277

Closed hr1232 closed 1 year ago

hr1232 commented 2 years ago

⚠️ This issue respects the following points: ⚠️

Bug description

Exception: The arguments array must contain 2 items, 1 given in file '/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php' line 88

Syntax error in L10NString.php is crapping into my logs constantly. This is quite annoying....

Steps to reproduce

  1. Seems to be loogs for every site request
  2. NextCloud Version 24.0.5
  3. Selected language is German

Expected behavior

Log entries should not be displayed

Installation method

Community Web installer on a VPS or web space

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

Can't provide that, no CLI access

List of activated Apps

Brute-force settings
Calendar
Checksum
Contacts
Contacts Interaction
Deleted files
Dropbox integration
External storage support
External user authentication
Federation
File sharing
GitHub integration
Google integration
Log Reader
Metadata
Monitoring
Notifications
OneDrive integration
Password policy
PDF viewer
Photos
Quota warning
Ransomware protection
Registration
Right click
Share by mail
Splash
Terms of service
Two-Factor Authentication via Nextcloud notification
Two-Factor Email
Two-Factor TOTP Provider
Two-Factor WebAuthn
Update notification
User account deletion
Video player

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

Same message over and over again

{
  "reqId": "hTdvG2WszXpnhZUeBXMM",
  "level": 3,
  "time": "2022-09-27T06:20:35+00:00",
  "remoteAddr": "162.158.91.127",
  "user": "heikorichter",
  "app": "no app in context",
  "method": "GET",
  "url": "/ocs/v2.php/apps/notifications/api/v2/notifications",
  "message": "The arguments array must contain 2 items, 1 given in file '/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php' line 88",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.54",
  "version": "24.0.5.1",
  "exception": {
    "Exception": "Exception",
    "Message": "The arguments array must contain 2 items, 1 given in file '/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php' line 88",
    "Code": 0,
    "Trace": [
      {
        "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php",
        "line": 62,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v2.php",
        "line": 23,
        "args": [
          "/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 165,
    "Previous": {
      "Exception": "ValueError",
      "Message": "The arguments array must contain 2 items, 1 given",
      "Code": 0,
      "Trace": [
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php",
          "line": 88,
          "function": "vsprintf"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10N.php",
          "line": 127,
          "function": "__toString",
          "class": "OC\\L10N\\L10NString",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/LazyL10N.php",
          "line": 56,
          "function": "n",
          "class": "OC\\L10N\\L10N",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/apps/integration_google/lib/Notification/Notifier.php",
          "line": 92,
          "function": "n",
          "class": "OC\\L10N\\LazyL10N",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Notification/Manager.php",
          "line": 376,
          "function": "prepare",
          "class": "OCA\\Google\\Notification\\Notifier",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/apps/notifications/lib/Controller/EndpointController.php",
          "line": 111,
          "function": "prepare",
          "class": "OC\\Notification\\Manager",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 225,
          "function": "listNotifications",
          "class": "OCA\\Notifications\\Controller\\EndpointController",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 133,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/App.php",
          "line": 172,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Route/Router.php",
          "line": 298,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php",
          "line": 62,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v2.php",
          "line": 23,
          "args": [
            "/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php",
      "Line": 88
    },
    "CustomMessage": "--"
  },
  "id": "6332963362cd9"
}

Additional info

No response

kesselb commented 2 years ago

Hi, thanks for your report.

Can you patch your instance like

Index: lib/private/L10N/L10NString.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php
--- a/lib/private/L10N/L10NString.php   (revision 0e41530b807244e213e3e2566c0ffe30ed809a32)
+++ b/lib/private/L10N/L10NString.php   (date 1664286507964)
@@ -85,7 +85,11 @@
        // $count as %count% as per \Symfony\Contracts\Translation\TranslatorInterface
        $text = $identityTranslator->trans($identity, $parameters);

-       return vsprintf($text, $this->parameters);
+       try {
+           return vsprintf($text, $this->parameters);
+       } catch (\ValueError $e) {
+           throw new \LogicException('The arguments array must contain 2 items, 1 given for ' . $text, 0, $e);
+       }
    }

    public function jsonSerialize(): string {

to figure out which string is causing this issue?

hr1232 commented 2 years ago

OK. As the issue is not blocking any functionality, I'll do that tonight when users are off work.

Maybe, future versions should create log entries with a bit more useful information instead of all that useless, nerdy verbousness...

kesselb commented 2 years ago

Maybe, future versions should create log entries with a bit more useful information instead of all that useless, nerdy verbousness...

Brilliant idea! Please send a pull request: https://github.com/nextcloud/server#join-the-team-

hr1232 commented 2 years ago

Here you go. Seems to trace back to Google integration

{"reqId":"yJCB3Tidg8FmtDofrxSk","level":3,"time":"2022-09-27T16:14:27+00:00","remoteAddr":"172.70.242.28","user":"heikorichter","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"The arguments array must contain 2 items, 1 given for %s Foto wurde von Google importiert.|%s Fotos wurden von Google importiert.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36","version":"24.0.5.1","exception":{"Exception":"LogicException","Message":"The arguments array must contain 2 items, 1 given for %s Foto wurde von Google importiert.|%s Fotos wurden von Google importiert.","Code":0,"Trace":[{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10N.php","line":127,"function":"__toString","class":"OC\\L10N\\L10NString","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/LazyL10N.php","line":56,"function":"n","class":"OC\\L10N\\L10N","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/apps/integration_google/lib/Notification/Notifier.php","line":92,"function":"n","class":"OC\\L10N\\LazyL10N","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Notification/Manager.php","line":376,"function":"prepare","class":"OCA\\Google\\Notification\\Notifier","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/apps/notifications/lib/Controller/EndpointController.php","line":111,"function":"prepare","class":"OC\\Notification\\Manager","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"listNotifications","class":"OCA\\Notifications\\Controller\\EndpointController","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php","line":62,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v2.php","line":23,"args":["/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php"],"function":"require_once"}],"File":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php","Line":91,"Previous":{"Exception":"ValueError","Message":"The arguments array must contain 2 items, 1 given","Code":0,"Trace":[{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php","line":89,"function":"vsprintf"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10N.php","line":127,"function":"__toString","class":"OC\\L10N\\L10NString","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/LazyL10N.php","line":56,"function":"n","class":"OC\\L10N\\L10N","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/apps/integration_google/lib/Notification/Notifier.php","line":92,"function":"n","class":"OC\\L10N\\LazyL10N","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Notification/Manager.php","line":376,"function":"prepare","class":"OCA\\Google\\Notification\\Notifier","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/apps/notifications/lib/Controller/EndpointController.php","line":111,"function":"prepare","class":"OC\\Notification\\Manager","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"listNotifications","class":"OCA\\Notifications\\Controller\\EndpointController","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php","line":62,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v2.php","line":23,"args":["/usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php"],"function":"require_once"}],"File":"/usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10NString.php","Line":89},"CustomMessage":"--"},"id":"6333216381931"}

`[no app in context] Fehler: LogicException: The arguments array must contain 2 items, 1 given for %s Foto wurde von Google importiert.|%s Fotos wurden von Google importiert. at <>

  1. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/L10N.php line 127 OC\L10N\L10NString->__toString()
  2. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/L10N/LazyL10N.php line 56 OC\L10N\L10N->n()
  3. /usr/www/users/heikorm/cloud.heikorichter.name/apps/integration_google/lib/Notification/Notifier.php line 92 OC\L10N\LazyL10N->n()
  4. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Notification/Manager.php line 376 OCA\Google\Notification\Notifier->prepare()
  5. /usr/www/users/heikorm/cloud.heikorichter.name/apps/notifications/lib/Controller/EndpointController.php line 111 OC\Notification\Manager->prepare()
  6. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php line 225 OCA\Notifications\Controller\EndpointController->listNotifications()
  7. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/Http/Dispatcher.php line 133 OC\AppFramework\Http\Dispatcher->executeController()
  8. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/AppFramework/App.php line 172 OC\AppFramework\Http\Dispatcher->dispatch()
  9. /usr/www/users/heikorm/cloud.heikorichter.name/lib/private/Route/Router.php line 298 OC\AppFramework\App::main()
  10. /usr/www/users/heikorm/cloud.heikorichter.name/ocs/v1.php line 62 OC\Route\Router->match()
    1. /usr/www/users/heikorm/cloud.heikorichter.name/ocs/v2.php line 23 require_once("/usr/www/users/ ... p")

GET /ocs/v2.php/apps/notifications/api/v2/notifications from 172.70.247.63 by heikorichter at 2022-09-27T16:16:53+00:00`

kesselb commented 2 years ago

cc @eneiluj

ChristophWurst commented 2 years ago

See https://github.com/nextcloud/server/pull/33639 for a similar problem and fix.

szaimen commented 1 year ago

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

shalak commented 1 year ago

@szaimen I'm on 25.0.3 and I see this issue.

Bromelioideae commented 1 year ago

@szaimen I am on 25.0.3 and I am experiencing this is issue as well. It doesn't seem to affect functionality and I only noticed it when I went to check on my fail2ban jail for nextcloud which depends on nextcloud.log and didn't see any entries but my nextcloud.access log had lots of entries for IPs I don't recognise so I went to check nextcloud.log and it has stopped logging since December 25 last year. I will be glad to provide any further information you require.

0xs0lox0 commented 1 year ago

I'm on 25.0.3 and i've the same problem: Seems to trace back to Google integration too

An error appears in the log every five minutes:

{"reqId":"0Z7DqfMq9gom5LxFzNIx","level":3,"time":"2023-02-28T19:55:24+00:00","remoteAddr":"192.168.1.1","user":"s0lo","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"The arguments array must contain 4 items, 1 given in file '/snap/nextcloud/33730/htdocs/lib/private/L10N/L10NString.php' line 88","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36","version":"25.0.3.2","exception":{"Exception":"Exception","Message":"The arguments array must contain 4 items, 1 given in file '/snap/nextcloud/33730/htdocs/lib/private/L10N/L10NString.php' line 88","Code":0,"Trace":[{"file":"/snap/nextcloud/33730/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/33730/htdocs/ocs/v1.php","line":63,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/ocs/v2.php","line":23,"args":["/snap/nextcloud/33730/htdocs/ocs/v1.php"],"function":"require_once"}],"File":"/snap/nextcloud/33730/htdocs/lib/private/AppFramework/Http/Dispatcher.php","Line":165,"Previous":{"Exception":"ValueError","Message":"The arguments array must contain 4 items, 1 given","Code":0,"Trace":[{"file":"/snap/nextcloud/33730/htdocs/lib/private/L10N/L10NString.php","line":88,"function":"vsprintf"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/L10N/L10N.php","line":127,"function":"__toString","class":"OC\\L10N\\L10NString","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/L10N/LazyL10N.php","line":56,"function":"n","class":"OC\\L10N\\L10N","type":"->"},{"file":"/var/snap/nextcloud/33730/nextcloud/extra-apps/integration_google/lib/Notification/Notifier.php","line":92,"function":"n","class":"OC\\L10N\\LazyL10N","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/Notification/Manager.php","line":368,"function":"prepare","class":"OCA\\Google\\Notification\\Notifier","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/apps/notifications/lib/Controller/EndpointController.php","line":111,"function":"prepare","class":"OC\\Notification\\Manager","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"listNotifications","class":"OCA\\Notifications\\Controller\\EndpointController","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/33730/htdocs/ocs/v1.php","line":63,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/33730/htdocs/ocs/v2.php","line":23,"args":["/snap/nextcloud/33730/htdocs/ocs/v1.php"],"function":"require_once"}],"File":"/snap/nextcloud/33730/htdocs/lib/private/L10N/L10NString.php","Line":88},"CustomMessage":"--"},"id":"63fe5c2d0b940"}

[no app in context] Error: Exception: The arguments array must contain 4 items, 1 given in file '/snap/nextcloud/33730/htdocs/lib/private/L10N/L10NString.php' line 88 at <>

  1. /snap/nextcloud/33730/htdocs/lib/private/AppFramework/App.php line 172 OC\AppFramework\Http\Dispatcher->dispatch()
  2. /snap/nextcloud/33730/htdocs/lib/private/Route/Router.php line 298 OC\AppFramework\App::main()
  3. /snap/nextcloud/33730/htdocs/ocs/v1.php line 63 OC\Route\Router->match()
  4. /snap/nextcloud/33730/htdocs/ocs/v2.php line 23 require_once("/snap/nextcloud/33730/htdocs/ocs/v1.php")

GET /ocs/v2.php/apps/notifications/api/v2/notifications from 192.168.1.1 by s0lo at 2023-02-28T19:55:24+00:00

hugalafutro commented 1 year ago

Same issue persists on 25.0.5, although functionality seems unaffected I don't like the log spam.

joshtrichards commented 1 year ago

App issue not a server matter: nextcloud/integration_google#133

Sounds like it was fixed in 2.x released in May 2023 (so a few months after the last report in this thread here).

https://github.com/nextcloud/integration_google/issues/133#issuecomment-1573570316

Take further follow-up to that issue/repository. Closing here. Thanks for all your reports.