System Upgrade resulted in PHP Fatal Error

Support intro

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

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

The issue you are facing:
After updating my system, when I try to run occ I get the following error.

PHP Fatal error:  Declaration of OC\AppFramework\Utility\SimpleContainer::get(string $id) must be compatible with Psr\Container\ContainerInterface::get($id) in /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 55

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

Steps to replicate it:

  1. Updated the system

Temporary solution is to change the parts of the lines 55 and 59 in lib/private/AppFramework/Utility/SimpleContainer.php from (string $id) to ($id). But the integrity check fails, as the file will no longer have the same hash.

I also opened a request on github.