mail icon indicating copy to clipboard operation
mail copied to clipboard

Optional parameter $knownIds declared before required parameter $partialOnly is implicitly treated as a required parameter at /config/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php#111

Open loddi opened this issue 10 months ago • 7 comments

Steps to reproduce

After the update to nextcloud 29 I see this message a lot in the logs.

Expected behavior

no PHP error in the logs

Actual behavior

The following message is shown in the logs: "Optional parameter $knownIds declared before required parameter $partialOnly is implicitly treated as a required parameter at /config/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php#111"

Mail app version

3.6.0

Mailserver or service

selfhosted

Operating system

docker

PHP engine version

None

Web server

None

Database

None

Additional info

No response

loddi avatar Apr 25 '24 16:04 loddi

I have the same error message in my logs with NC 28 and can't tell where they are coming from. It is a freshly new (1 week old) NC installation.

NC 28.0.4 PHP 8.1.2 Mail Version: 3.6.0

Detailed log entry:

{
{
  "reqId": "XXX",
  "level": 3,
  "time": "2024-04-26T06:47:54+00:00",
  "remoteAddr": "XXX",
  "user": "XXX",
  "app": "PHP",
  "method": "GET",
  "url": "/nextcloud/index.php/apps/mail/api/accounts/1/test",
  "message": "Optional parameter $knownIds declared before required parameter $partialOnly is implicitly treated as a required parameter at /var/www/vhosts/XXX.de/httpdocs/nextcloud/apps/mail/lib/Service/Sync/SyncService.php#111",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "version": "28.0.4.1",
  "data": {
    "app": "PHP"
  },
  "id": "662b51e197ac8"
}
}

PottiMc avatar Apr 26 '24 07:04 PottiMc

can't tell where they are coming from

You have upgraded to PHP8: https://php.watch/versions/8.0/deprecate-required-param-after-optional

ChristophWurst avatar Apr 26 '24 11:04 ChristophWurst

It is unexpected to see this logged with level 3 (error). Deprecations should only show up at loglevel=0 (debug)

ChristophWurst avatar Apr 26 '24 11:04 ChristophWurst

can't tell where they are coming from

You have upgraded to PHP8: https://php.watch/versions/8.0/deprecate-required-param-after-optional

I did not upgrade. The AIO package for Plesk is coming with 8.1.2 and PHP7 is EOL since quite a time. Even 8.1. is deprecated already according to the system requirements.

https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html

PottiMc avatar Apr 26 '24 11:04 PottiMc

I have the same issue. Been using php8.3 since I installed it but didn't see these errors till I upgrade to nc29 and mail updated to 3.6.0. Also these aren't coming in on the debug log, they are coming in as errors.image

xkasprx avatar Apr 27 '24 05:04 xkasprx

It is unexpected to see this logged with level 3 (error). Deprecations should only show up at loglevel=0 (debug)

I was curious what changed in our code that introduced this specifically in 3.6.0 and it was #9420 (somewhat ironically).

The deprecation changed to an error in PHP 8.1.0 so the two scenarios collided in 3.6.0:

As of PHP 8.0.0, but prior to PHP 8.1.0, the below emits a deprecation notice on the definition, but runs successfully when called. As of PHP 8.1.0, an error of class ArgumentCountError is thrown, as it would be when called with positional arguments.

https://www.php.net/manual/en/migration81.incompatible.php

joshtrichards avatar Apr 28 '24 23:04 joshtrichards

So is there something I can do to get rid of these failures as a workaround?

PottiMc avatar May 02 '24 05:05 PottiMc

I have it too on a fresh installed Nextcloud 29 on Debian 12 with PHP 8.3

Nextcloud Hub 8 (29.0.0) Mail App 3.6.0

Sanookmakmak avatar May 13 '24 12:05 Sanookmakmak

Same here. fresh installed Nextcloud 29 on Ubuntu 22.04 with PHP 8.3 Nextcloud Hub 8 (29.0.0) Mail App 3.6.1

dustbro avatar May 17 '24 14:05 dustbro

Same here as well.

RemmyLee avatar May 17 '24 20:05 RemmyLee

Seeing the same error.

Lawkss avatar May 20 '24 09:05 Lawkss

Fixed in #9526

(not yet released however)

joshtrichards avatar May 20 '24 11:05 joshtrichards