Skip to content

ValueError in GitHubNotifier.php: vsprintf() expects more arguments than provided #197

@Githopp192

Description

@Githopp192

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.

Describe the bug

A ValueError occurs during the execution of background jobs (cron), specifically when the integration_github app attempts to prepare mail notifications. The error is triggered in L10NString.php because vsprintf() receives an insufficient number of arguments for the placeholders defined in the translation string.

Error Log / Stacktrace

Plaintext
ValueError: The arguments array must contain 2 items, 1 given
/var/www/html/nextcloud/lib/private/L10N/L10NString.php line 68
vsprintf()
/var/www/html/nextcloud/lib/private/L10N/L10N.php line 107
OC\L10N\L10NString->__toString()
/var/www/html/nextcloud/apps/integration_github/lib/Notification/GitHubNotifier.php line 45
OC\L10N\L10N->n()
...
OC\Notification\Manager->prepare()
OCA\Notifications\MailNotifications->sendEmailToUser()
Location of the Issue
File: lib/Notification/GitHubNotifier.php
Around line 45:

PHP
$content = $l->n(
'You have %s new unread notification with recent activity on GitHub.',
'You have %s new unread notifications with recent activity on GitHub.',
$newNotifications,
[$newNotifications]
);

Analysis

The call to $l->n() uses %s as a placeholder. In PHP 8.x, vsprintf is stricter. If a translation file (e.g., a local .json file) mistakenly uses multiple placeholders or if the internal Nextcloud L10N logic expects a secondary argument for plural rules (like %n), the single-item array [$newNotifications] causes the ValueError.

Additionally, standard Nextcloud practice for plural strings is using %n instead of %s.

Possible Fix

Change the placeholders to %n and ensure the parameters array is handled safely, or verify that the translation strings do not contain extra unexpected placeholders.

Server configuration

AlmaLinux release 8.10 (Cerulean Leopard)

Web server: Apache/Nginx
Apache/2.4.37

Database: MySQL/Maria/SQLite/PostgreSQL
11.4.10-MariaDB

PHP version: 8.2/8.3/8.4
PHP 8.3.30

Nextcloud version: :32.0.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions