PHP error at logging Error: Array to string conversion

Dear All,

I have php error at logging, How I can fix it.

Nextcloud version (eg, 20.0.5): 20.0.5
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.1 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41 (Ubuntu)
PHP version (eg, 7.4): PHP 7.4.3

The issue you are facing:

Is this the first time you’ve seen this error? (Y):

Steps to replicate it:

  1. Error: Array to string conversion at /var/www/html/lib/private/L10N/L10NString.php#79

The output of your Nextcloud log in Admin > Logging:

Error: Array to string conversion at /var/www/html/lib/private/L10N/L10NString.php#79
<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/html/lib/private/L10N/L10NString.php - line 79:

vsprintf()

/var/www/html/lib/private/L10N/L10N.php - line 110:

OC\L10N\L10NString->__toString()

/var/www/html/lib/private/L10N/LazyL10N.php - line 53:

OC\L10N\L10N->t()

/var/www/html/apps/updatenotification/lib/Notification/Notifier.php - line 145:

OC\L10N\LazyL10N->t()

/var/www/html/lib/private/Notification/Manager.php - line 299:

OCA\UpdateNotification\Notification\Notifier->prepare()

/var/www/html/apps/notifications/lib/Controller/EndpointController.php - line 106:

OC\Notification\Manager->prepare()

/var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 169:

OCA\Notifications\Controller\EndpointController->listNotifications()

/var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 100:

OC\AppFramework\Http\Dispatcher->executeController()

/var/www/html/lib/private/AppFramework/App.php - line 152:

OC\AppFramework\Http\Dispatcher->dispatch()

/var/www/html/lib/private/Route/Router.php - line 309:

OC\AppFramework\App::main()

/var/www/html/ocs/v1.php - line 88:

OC\Route\Router->match()

/var/www/html/ocs/v2.php - line 24:

require_once("/var/www/html/ocs/v1.php")

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
    2 => '',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '20.0.5.2',
  'overwrite.cli.url' => '',
  'dbname' => '',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,

The output of your Apache/nginx/system log in /var/log/____:

[Wed Aug 04 14:28:20.295748 2021] [access_compat:error] [pid 12079] [client 183.88.110.189:54187] AH01797: client denied by server configuration: /var/www/html/data/.ocdata
[Wed Aug 04 14:31:25.746045 2021] [access_compat:error] [pid 12502] [client 183.88.110.189:54958] AH01797: client denied by server configuration: /var/www/html/data/.ocdata
1 Like

This appears to be related to something in the translation strings (despite that I use Nextcloud in default English)

        public function __toString() {
                $translations = $this->l10n->getTranslations();

                $text = $this->text;
                if (array_key_exists($this->text, $translations)) {
                        if (is_array($translations[$this->text])) {
                                $fn = $this->l10n->getPluralFormFunction();
                                $id = $fn($this->count);
                                $text = $translations[$this->text][$id];
                        } else {
                                $text = $translations[$this->text];
                        }
                }

                // Replace %n first (won't interfere with vsprintf)
79             $text = str_replace('%n', (string)$this->count, $text);
                return vsprintf($text, $this->parameters);
        }

I think it’s safe to ignore it, it went over after 2021-07-19 for me, I probably did a Nextcloud update then which fixed the error.