Skip to content

logtimezone is always UTC (lib/private/Setup.php:378 useless due to lib/base.php:636) #3553

@robert-scheck

Description

@robert-scheck

Steps to reproduce

  1. Get Nextcloud 11.0.1
  2. Ensure php -r "echo date_default_timezone_get() . PHP_EOL;" returns "Europe/Berlin"
  3. ./occ maintenance:install --data-dir=/var/www/html/data --database mysql --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin
  4. grep logtimezone config/config.php will return "UTC" rather "Europe/Berlin".

Expected behaviour

logtimezone should be consistent with php -r "echo date_default_timezone_get() . PHP_EOL;" setting.

Actual behaviour

logtimezone is always UTC, even php -r "echo date_default_timezone_get() . PHP_EOL;" returns "Europe/Berlin".

Server configuration

Operating system: Red Hat Enterprise Linux 7.3, but doesn't matter here anyway.

Web server: Apache Webserver 2.4, but doesn't matter here anyway.

Database: MariaDB 5.5, but doesn't matter here anyway.

PHP version: 7.1 (via Remi Safe repository), but doesn't matter here anyway.

Nextcloud version: 11.0.1

Updated from an older Nextcloud/ownCloud or fresh install: Fresh installation.

Where did you install Nextcloud from: https://download.nextcloud.com/server/releases/nextcloud-11.0.1.tar.bz2

Signing status: N/A

List of activated apps: N/A

The content of config/config.php: N/A

Are you using external storage, if yes which one: No external storage.

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Analysis

The lib/base.php:636 sets PHP internal timezone unconditionally to UTC:

if(!date_default_timezone_set('UTC')) {
    throw new \RuntimeException('Could not set timezone to UTC');
};

Later called lib/private/Setup.php:378 fetches this newly set timezone rather the original setting from php.ini file:

if (date_default_timezone_get()) {
    $config->setSystemValue('logtimezone', date_default_timezone_get());
}

Conclusion: lib/private/Setup.php:378 useless due to lib/base.php:636.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions