Error PHP74 - Trying to access array offset on value of type null

Although the configuration of my Nextcloud may be different, I have found that Scanning all files using the files:scan command in occ floods my Nextcloud log with a variant of this error. Seeing how the community could provide valuable information to any developers folowing this topic, it would be great if @Oriann updates the original post by providing the versions of the software used in his installation, to help reduce the number of these errors.

Here are the details of my installation:

The Nextcloud package is installed, using an archive file, on a shared hosting server with some folders connected to external storage.
Nextcloud version: 18.0.4, 18.0.6 => 18.0.7
Operating system and version: Ubuntu 18.04
Apache or nginx version: Apache 2.4.29
PHP version: 7.4.3

The issue you are facing: refer to the first paragraph of my post in this topic.

The output of your Nextcloud log in Admin > Logging:

[PHP Errors] – Trying to access array offset on value of type null at /home/ssh-user/domain.tld/nextcloud/3rdparty/aws/aws-sdk-php/src/RetryMiddleware.php#144

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

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

$CONFIG = array (
  'instanceid' => 'ocnssr8i2s5s',
  'passwordsalt' => 'unsalted',
  'secret' => 'notso',
  'trusted_domains' =>
  array (
    0 => 'domain.tld',
  'datadirectory' => '/home/ssh-user/domain.tld/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'https://domain.tld/nextcloud',
  'dbname' => 'honeysuckle_squirt',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'meee',
  'dbpassword' => 'pass12345',
  'installed' => true,
  'maintenance' => false,

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


N.B. Agree with @andyp that the errors persist when upgrading to PHP 7.4 from PHP 7.2, while using a point release following Nextcloud 17.0.1

Issues with deleting, moving, and renaming files - External storage

1 Like

Same error to me after upgrading NC-18.0.10 to PHP-7.2 >> PHP-7.4.11 (HostEurope):

Trying to access array offset on value of type null at /is/htdocs/wp10xxxxxxxxxxxxx/ncw/3rdparty/leafo/scssphp/src/Compiler.php#5230

How to solve this issue?

Thx + regards!

Just small update, I have backed up my data and removed whole nextcloud and installed the latest version 20.0.2 and recovered data. Now theese weird errors are gone forever - uptime 7 days from now.

I suggest others to do the same because nc was somehow bugged in earlier versions and I have faced multiple errors.

EDIT: Using PHP 7.4, nginx 18 only OS changed to Ubuntu, but it should not matter cus I am not installing nc as pkg or apt nor snap


Hi @Oriann

can you maybe share how did you backup ed & restored your data?
I have hundreds of GB of data and multiple user on this service, a copy&paste would be quite terrific to perform.
Thanks for sharing, can’t wait to see this error disappear forever too!

Do you have separate folder for nextcloud data (your data) ? If you have then only backup this folder and reinstall nextcloud. After that edit this line in config.php in /var/www/nextcloud/config/

‘datadirectory’ => ‘/var/www/YOURFOLDERHERE’,

If you have not separated data then you will need to extract it from nextcloud folder. I am not familiar with that because I have done the first option …

Hi Oriann,

thanks for sharing!

I do have a separate folder.
My concern is about the database, if anything in NC20 changes on that regards (tables etc), it should be somehow also upgraded. If the DB gets corrupted the data might not be accessible anymore I believe?

You dont need to do anything with db, you will connect it after reinstalling nc. Just edit the config.php file to match the current config.php after you reinstall. Just match DB and caching things and it should work normally.