Error: Undefined offset: 3 at /var/www/nextcloud/lib/private/legacy/OC_Helper.php#548

Nextcloud version: 20.0.1
Operating system and version: Debian 10
Apache or nginx version: Apache 2.4.38
PHP version: 7.3

The issue you are facing:

After upgrading NC to 20.0.1, i’m continuously receive this error:

Error: Undefined offset: 3 at /var/www/nextcloud/lib/private/legacy/OC_Helper.php#548

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

Steps to replicate it:

  1. Upgrade to 20.0.1
  2. On web interface, as administrator, navigate to any tab or menu, then see the Logging section

The output of your Nextcloud log in Admin > Logging:

[PHP] Error: Error: Undefined offset: 3 at /var/www/nextcloud/lib/private/legacy/OC_Helper.php#548 at <<closure>>

 0. /var/www/nextcloud/lib/private/legacy/OC_Helper.php line 548
    OC\Log\ErrorHandler::onError(8, "Undefined offset: 3", "/var/www/nextcl ... p", 548, {path: "/",rootI ... }})
 1. /var/www/nextcloud/apps/settings/lib/Settings/Personal/PersonalInfo.php line 108
    OC_Helper::getStorageInfo("/")
 2. /var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php line 141
    OCA\Settings\Settings\Personal\PersonalInfo->getForm()
 3. /var/www/nextcloud/apps/settings/lib/Controller/PersonalSettingsController.php line 77
    OCA\Settings\Controller\PersonalSettingsController->formatSettings({10: [OCA\Settin ... ]})
 4. /var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php line 152
    OCA\Settings\Controller\PersonalSettingsController->getSettings("personal-info")
 5. /var/www/nextcloud/apps/settings/lib/Controller/PersonalSettingsController.php line 68
    OCA\Settings\Controller\PersonalSettingsController->getIndexResponse("personal", "personal-info")
 6. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 169
    OCA\Settings\Controller\PersonalSettingsController->index("personal-info")
 7. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings\Con ... {}, "index")
 8. /var/www/nextcloud/lib/private/AppFramework/App.php line 152
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings\Con ... {}, "index")
 9. /var/www/nextcloud/lib/private/Route/Router.php line 308
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "index", OC\AppFramework\ ... {}, {section: "perso ... "})
10. /var/www/nextcloud/lib/base.php line 1009
    OC\Route\Router->match("/settings/user")
11. /var/www/nextcloud/index.php line 37
    OC::handleRequest()

GET /index.php/settings/user
from **ip address** by **username** at 2020-10-26T15:38:47+00:00

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

$CONFIG = array (
  'instanceid' => '**removed**',
  'passwordsalt' => '**removed**',
  'secret' => '**removed**',
  'trusted_domains' => 
  array (
    0 => '**my nextcloud address**',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.1.1',
  'overwrite.cli.url' => 'http://**internal ip**',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '**removed**',
  'dbpassword' => '**removed**',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_from_address' => '**removed**',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'gmail.com',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '**removed**',
  'mail_smtpport' => '465',
  'mail_smtpname' => '**removed**',
  'mail_smtppassword' => '**removed**',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'updater.secret' => '**removed**',
  'theme' => '',
  'loglevel' => 2,
);

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

[Mon Oct 26 00:00:04.069481 2020] [mpm_event:notice] [pid 652:tid 140686610564224] AH00489: Apache/2.4.38 (Debian) mod_fcgid/2.3.9 OpenSSL/1.1.1d configured -- resuming normal operations
[Mon Oct 26 00:00:04.069509 2020] [core:notice] [pid 652:tid 140686610564224] AH00094: Command line: '/usr/sbin/apache2'
[Mon Oct 26 07:48:44.002514 2020] [mpm_event:notice] [pid 652:tid 140686610564224] AH00491: caught SIGTERM, shutting down
[Mon Oct 26 07:48:44.100551 2020] [mpm_event:notice] [pid 21078:tid 140214078096512] AH00489: Apache/2.4.38 (Debian) mod_fcgid/2.3.9 OpenSSL/1.1.1d configured -- resuming normal operations
[Mon Oct 26 07:48:44.100669 2020] [core:notice] [pid 21078:tid 140214078096512] AH00094: Command line: '/usr/sbin/apache2'
[Mon Oct 26 15:51:53.661668 2020] [mpm_event:notice] [pid 21078:tid 140214078096512] AH00491: caught SIGTERM, shutting down
[Mon Oct 26 15:52:09.463160 2020] [mpm_event:notice] [pid 666:tid 140034912429184] AH00489: Apache/2.4.38 (Debian) mod_fcgid/2.3.9 OpenSSL/1.1.1d configured -- resuming normal operations
[Mon Oct 26 15:52:09.465349 2020] [core:notice] [pid 666:tid 140034912429184] AH00094: Command line: '/usr/sbin/apache2'
[Mon Oct 26 17:08:44.676449 2020] [mpm_event:notice] [pid 666:tid 140034912429184] AH00491: caught SIGTERM, shutting down
[Mon Oct 26 17:08:58.309247 2020] [mpm_event:notice] [pid 651:tid 139621034624128] AH00489: Apache/2.4.38 (Debian) mod_fcgid/2.3.9 OpenSSL/1.1.1d configured -- resuming normal operations
[Mon Oct 26 17:08:58.309666 2020] [core:notice] [pid 651:tid 139621034624128] AH00094: Command line: '/usr/sbin/apache2'
5 Likes

Based on the following issue report a fix has already been scheduled for Nextcloud 21:

1 Like

This was backported to stable 20. So it should have been fixed in 20.0.1…

1 Like

Sorry, but the fix was prepared to late, so that it will be fixed earliest with the upcoming v20.0.2 release. See this comment.

3 Likes

Thanks for clearing that up :slight_smile: So, we’ll have to wait for next update or add the fix manually :+1:

Yes, problem certainly still present in 20.0.1

2 Likes

It’s in 20.0.1, and it’s made Nextcloud unusable. I get errors trying to anything - get a listing of the files, or doing any action on any files throws these errors in the logs.

Is there a known date for when 20.0.2 will be released? Or is the only way this will be fixed sooner is to upgrade to a beta?

TIA.

2 Likes

Have a look on the issue ticket and the applied fix. Usually it should be possible to get the file differences displayed so that you can patch your files on your own.

4 Likes

I just applied the fix from the issue ticket, now the error is gone. Thanks @j-ed.

1 Like

For others with the issue - It’s easier to pull the entire file from the master branch (https://github.com/nextcloud/server/blob/master/lib/private/legacy/OC_Helper.php) and just replace it.

Thanks.

8 Likes

@kchoi That was the easiest solution. Thanks :blush:

thanks, it works. :crazy_face:

1 Like

Okay guys, sorry for asking, I’m new to NC. I just installed it viaweb installer of my web hoster (20.0.1). I also keep seeing this error and I understand I should replace a specific file by the version posted here: https://github.com/nextcloud/server/blob/master/lib/private/legacy/OC_Helper.php

Which file needs to be replaced by that? Could you please tell me the exact path?

Thanks and best regards
Jens

Hi Jens,
You want to replace OC_Helper.php with what is in github.

I can’t tell you the exact path, because it depends on where your web hoster installed it. The error you see in the logs will tell you the exact path of the file giving the error, so download the file from github, and upload/copy that file to the path from your logs. You may have to open a ticket with your web hoster for further assistance.

HTH.

1 Like

You need to search/replace the file ./lib/private/legacy/OC_Helper.php from your Nextcloud document root folder :wink:

1 Like

Thanks, found it and fixed it :slight_smile:

Easiest way for me was to use Total Commander to access the web server, then find the file, hit “F4”, paste the above posted code to overwrite the existing one and save it. Since then, the problem is gone.

2 Likes

The best way to find that file is to search for it:
sudo find / -name OC_Helper.php
Once you got the file location, delete it and replace with the github’s file: https://github.com/nextcloud/server/blob/master/lib/private/legacy/OC_Helper.php

Replaced “OC_Helper.php” with the version from master branch.
Now I am met with this message on nextcloud login page:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

I also replaced the “OC_Helper.php” and it worked for some time.
Today i got this :frowning: :
Fatal error: Unknown: Failed opening required ‘/var/www/html/index.php’ (include_path=’.:/usr/local/lib/php’) in Unknown on line 0

I found out, that something might be wrong with my mariaDB now:


So i restarted everything and it was still there. Than i looked into the mariaDB log:

I don’t know if this caused it, but i assume this is the only thing i changed (on purpose).

Please don’t hijack a closed thread, instead open a new one and describe your problem there. Changing a php script of Nextcloud can usually not influence the database start.

1 Like