recognize icon indicating copy to clipboard operation
recognize copied to clipboard

Recognize spams the logs with "Implicitly marking parameter $factory as nullable is deprecated, the explicit nullable"

Open Morethanevil opened this issue 9 months ago • 9 comments

Which version of recognize are you using?

9.0.0

Enabled Modes

Object recognition

TensorFlow mode

Normal mode

Downstream App

Files App

Which Nextcloud version do you have installed?

31.0.0 RC4

Which Operating system do you have installed?

Ubuntu 24.04

Which database are you running Nextcloud on?

Postgres 17

Which Docker container are you using to run Nextcloud? (if applicable)

How much RAM does your server have?

64GB

What processor Architecture does your CPU have?

x86_64

Describe the Bug

After installing Recognize 9.0.0, Nextcloud spams the logs with:

OCA\Recognize\Vendor\Amp\Parallel\Worker\factory(): Implicitly marking parameter $factory as nullable is deprecated, the explicit nullable type must be used instead at /var/www/html/nextcloud/apps/recognize/vendor/amphp/parallel/lib/Worker/functions.php#84 

This runs every 5 minutes like the cronjob. I use PHP8.4

Expected Behavior

No errors in the logs :)

To Reproduce

Debug log

No response

Morethanevil avatar Feb 13 '25 19:02 Morethanevil

Hi Marcel 👋

I will look into it, thank you for the feedback!

marcelklehr avatar Feb 14 '25 05:02 marcelklehr

Any news on this?

Morethanevil avatar Mar 05 '25 11:03 Morethanevil

This is an issue with a dependency of recognize, so fingers crossed an update will fix this.

marcelklehr avatar Mar 10 '25 07:03 marcelklehr

Fingers crossed :D

Morethanevil avatar Mar 10 '25 09:03 Morethanevil

I upgraded to 9.0.1 but I still get errors 😅

Latest version

Image

Deleted the log file, restarted Apache and PHP FPM

Image

Morethanevil avatar Apr 10 '25 10:04 Morethanevil

Damn :/

marcelklehr avatar Apr 10 '25 11:04 marcelklehr

same problem here

grericht avatar Apr 13 '25 22:04 grericht

I also have the issue.
Looks like it's a known PHP 8.4 deprecation, noted here >> (https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated)

fredcwells avatar Apr 20 '25 22:04 fredcwells

This looks like it was fixed in the dependency via https://github.com/amphp/parallel/commit/014bd5d5108cb7fb96ced1c0e228386b5112cd52 in >= v2.0.0.

However, we're on 1.4.x:

https://github.com/nextcloud/recognize/blob/37139575bbf5a4ba67edaffcd731c8c9ff397b20/composer.json#L7

Bumping >=v2.x may require some work:

https://github.com/amphp/parallel/releases/tag/v2.0.0

joshtrichards avatar Apr 26 '25 13:04 joshtrichards

My logs are getting spammed by a different error message now:

OCA\Recognize\Vendor\voku\helper\UTF8::reduce_string_array(): Implicitly marking parameter $remove_short_values as nullable is deprecated, the explicit nullable type must be used instead at /var/www/nextcloud/apps/recognize/vendor/voku/portable-utf8/src/voku/helper/UTF8.php#10690 

Recognize: 9.0.3 Nextcloud: 31.0.6

jonasbb avatar Jul 11 '25 13:07 jonasbb

PHP 8.2+ is stricter with type hints: if a function argument can be null, it must be declared as ?type $name instead of just having a default null value.

based on my logs I had to patch six functions (might be more) in apps/recognize/vendor/voku/portable-utf8/src/voku/helper/UTF8.php:

  1. in function reduce_string_array from int $remove_short_values = null to
?int $remove_short_values = null
  1. in function wordwrap_per_line to
?string $delimiter = null
  1. and in function ucfirst to
?string $lang = null
  1. and in function trim to
?string $chars = null
  1. and in function titlecase to
?string $lang = null
  1. and in function substr_in_byte to
?int $length = null

I hope this can be fixed in next release.

kem-a avatar Jul 29 '25 15:07 kem-a

Hi @marcelklehr I just wanted to tell you, since v10.0.4 this error does not occur anymore. Resolved for me, you can close this issue if you want :)

Morethanevil avatar Nov 04 '25 23:11 Morethanevil

Will this change be backported to Nextcloud version 31? Because we are still on 9.0.7, at the time I am writing this.

kman3107 avatar Nov 05 '25 16:11 kman3107

Will this change be backported to Nextcloud version 31?

Ah, yes. I'm on it.

marcelklehr avatar Nov 10 '25 12:11 marcelklehr

v9.0.8 is out now

marcelklehr avatar Nov 10 '25 13:11 marcelklehr