A fatal error occurred - php8

Hi, i migrated from php 7.3 to 8, everything seems to work fine but if i go to Diagnostic > System check it throw fatal error:

A fatal error occurred

The following error just broke Matomo (v4.12.3):

count(): Argument #1 ($value) must be of type Countable|array, null given in /matomo/core/Filesystem.php line 154

Does anybody know why this happens and how to solve?
Thank’s in advance