owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.37k stars 2.06k forks source link

OC8: DateTimeZone::__construct(): Unknown or bad timezone () #14176

Closed rinchen closed 9 years ago

rinchen commented 9 years ago

Howdy,

I'm not sure if I'm conflating two issues here or not but the errors here are quite similar. This started happened as far as I can tell after the upgrade to 8.0 from 7 via the Suse Build service repo. This error occurs on Ubuntu 14.04.1.

Steps to reproduce

  1. start up apache and let own cloud run

    Expected behaviour

No errors :-)

Actual behaviour

DateTimeZone::__construct() errors in own cloud.log (see below)

Server configuration

Ubuntu 14.04.1

Web server: apache2 2.4.9

Database: mysql 5.5.41

PHP version: php5 5.5.9

ownCloud version: owncloud 8.0.0-5

Updated from an older ownCloud or fresh install: updated via repo

List of activated apps:

I should point out that I disabled calendar because I was also seeing these message in the calendar app sporadically. I left the Calendar app disabled for troubleshooting.

The content of config/config.php:

<?php
$CONFIG = array (
  'installed' => true,
  'dbtype' => 'mysql',
  'dbname' => 'owncloud',
  'dbuser' => 'owncloud',
  'dbpassword' => 'XXXX',
  'dbhost' => '127.0.0.1',
  'dbtableprefix' => 'oc_',
  'passwordsalt' => 'XXX',
  'forcessl' => true,
  'blacklisted_files' =>
  array (
    0 => '.htaccess',
  ),
  'overwritehost' => '',
  'overwriteprotocol' => '',
  'overwritewebroot' => '/owncloud',
  'overwritecondaddr' => '',
  'proxy' => '',
  'proxyuserpwd' => '',
  'overwrite.cli.url' => 'owncloud',
  'trusted_domains' =>
  array (
    0 => 'ourowncloud.org',
    1 => 'www.ourowncloud.org',
  ),
  'theme' => '',
  'default_language' => 'en',
  '3rdpartyroot' => '',
  '3rdpartyurl' => '',
  'defaultapp' => 'files',
  'knowledgebaseenabled' => true,
  'appstoreenabled' => true,
  'appstoreurl' => 'http://api.apps.owncloud.com/v1',
  'mail_domain' => 'ourowncloud.org',
  'mail_smtpdebug' => false,
  'mail_smtpmode' => 'php',
  'mail_smtphost' => '127.0.0.1',
  'mail_smtpport' => '25',
  'mail_smtptimeout' => 10,
  'mail_smtpauthtype' => 'LOGIN',
  'memcached_server' =>
  array (
    0 => 'localhost',
    1 => 11211,
  ),
  'trashbin_retention_obligation' => 30,
  'trashbin_auto_expire' => true,
  'allow_user_to_change_display_name' => true,
  'appcodechecker' => '',
  'updatechecker' => true,
  'has_internet_connection' => true,
  'check_for_working_webdav' => false,
  'check_for_working_htaccess' => true,
  'log_type' => 'owncloud',
  'logfile' => '',
  'loglevel' => '2',
  'logdateformat' => 'F d, Y H:i:s',
  'logtimezone' => 'America/Denver',
  'log_query' => false,
  'log_authfailip' => true,
  'log_rotate_size' => false,
  'remember_login_cookie_lifetime' => 1296000,
  'session_lifetime' => 86400,
  'session_keepalive' => true,
  'custom_csp_policy' => 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\'; frame-src *; img-src *; font-src \'self\' data:; media-src *',
  'xframe_restriction' => true,
  'maintenance' => false,
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/owncloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),
  'customclient_desktop' => '',
  'customclient_android' => '',
  'customclient_ios' => '',
  'enable_previews' => true,
  'preview_max_x' => NULL,
  'preview_max_y' => NULL,
  'preview_max_scale_factor' => 10,
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'preview_office_cl_parameters' => '',
  'enable_avatars' => true,
  'openssl' =>
  array (
  ),
  'singleuser' => false,
  'instanceid' => 'ocd217a6d34e',
  'version' => '8.0.0.7',
  'datadirectory' => '/srv/owncloud',
  'mail_from_address' => 'mail',
  'secret' => 'XXX',
);

Are you using external storage, if yes which one:

data directory is mapped in the config to /dev/sdb1 /srv/owncloud/ ext4 defaults 0 1

Are you using encryption: no

Logs

Web server error log

There are no errors in apache2 error.log

ownCloud log (data/owncloud.log)

{"reqId":"d1732bb3cde2a7f41de017c05b9b4ed3","remoteAddr":"","app":"no app in context","message":"Error while running background job: DateTimeZone::__construct(): Unknown or bad timezone ()","level":3,"time":"February 12, 2015 12:00:02"}
{"reqId":"d1732bb3cde2a7f41de017c05b9b4ed3","remoteAddr":"","app":"PHP","message":"DateTimeZone::__construct(): Unknown or bad timezone () at \/var\/www\/owncloud\/apps\/activity\/lib\/mailqueuehandler.php#198","level":3,"time":"February 12, 2015 12:00:02"}
{"reqId":"1bedbab15f65c79363de798b47990240","remoteAddr":"","app":"no app in context","message":"Error while running background job: DateTimeZone::__construct(): Unknown or bad timezone ()","level":3,"time":"February 12, 2015 12:15:02"}
{"reqId":"1bedbab15f65c79363de798b47990240","remoteAddr":"","app":"PHP","message":"DateTimeZone::__construct(): Unknown or bad timezone () at \/var\/www\/owncloud\/apps\/activity\/lib\/mailqueuehandler.php#198","level":3,"time":"February 12, 2015 12:15:02"}
{"reqId":"127247bd596dbfa8a13e2bd83e43a420","remoteAddr":"","app":"no app in context","message":"Error while running background job: DateTimeZone::__construct(): Unknown or bad timezone ()","level":3,"time":"February 12, 2015 12:30:02"}
rinchen commented 9 years ago

Also, in php.ini I've set

date.timezone = "America/Denver"

but that made no difference.

rinchen commented 9 years ago

I believe the errors in this case are coming from the "Email Server" section of the Admin UI. Mail stopped working with the upgrade and I was attempting to send test emails via PHP and Sendmail. mail.err is empty and none of the other logs I've looked at seem to register mail being sent. My working assumption is that the mail is stuck in the mail queue handler. I'm using CRON as noted in the log.

ghost commented 9 years ago

Hi,

note that there are two different php.ini files:

/etc/php5/apache2/php.ini (used by the webserver) /etc/php5/cli/php.ini (used by the php-cli and so by your CRON)

Have you set the Timezones in both of them?

rinchen commented 9 years ago

@RealRancor I didn't have it in cli. I've retested and the errors remain. Thanks for reminding me about it though. I could have sworn I added it but apparently not.

phritter commented 9 years ago

Hi all, Same error after upgrading on debian from OC 7 to OC 8. Also tried to define Timezone in both php.ini, but doesn't help. Always same error

phritter commented 9 years ago

Possible workaround : Edit emailnotification.php @ line 113 : $timezone = (isset($userTimezones[$user])) ? $userTimezones[$user] : date_default_timezone_get();

rinchen commented 9 years ago

14429 seems to be a fix for this thanks to @nickvergessen

nickvergessen commented 9 years ago

Okay, buta lets keep this issue open until the fix is merged

deMattin commented 9 years ago

I don't think, hard setting UTC is a solution. Edit emailnotification.php like "phritter" said is much better (but not best) because this uses server values as default. @ line 113 : $timezone = (isset($userTimezones[$user])) ? $userTimezones[$user] : date_default_timezone_get(); (don't know, if this code really works)

Further notes, please see: https://github.com/owncloud/activity/pull/244

MorrisJobke commented 9 years ago

Will be in 8.0.3 and 8.1

bascht commented 9 years ago

@MorrisJobke I'm experiencing

DateTimeZone::__construct(): Unknown or bad timezone (/freeassociation.sourceforge.net/Tzfile/Europe/Berlin) at /var/www/owncloud/3rdparty/sabre/vobject/lib/Sabre/VObject/TimeZoneUtil.php#412

after upgrading to 8.0.3. Can I help to debug or should I reopen this ticket?

MorrisJobke commented 9 years ago

This looks weird. Like a offset, that isn't used, because the end of the time zone is correct, but the /freeassociation.sourceforge.net/Tzfile/

cc @nickvergessen

bascht commented 9 years ago

Yep. It kind of started with the upgrade to 8.0.3 (see thread https://twitter.com/dmfs_org/status/600221518153527296 because I suspected CalDAV sync to be broken :D)

dmfs commented 9 years ago

@bascht did you use Evolution in the past? That TZID looks like the ones used by Evolution and it looks perfectly valid, given the corresponding VTIMEZONE object is valid as well. Also these TZIDs are around for quite some time (probably even longer than ownCloud supports CalDAV after all).

Please try to enable "Use WebDAV Method" in the settings of CalDAV-Sync. That could help working around this issue until it's fixed.

bascht commented 9 years ago

@dmfs I'm using the GNOME accounts on my desktop so there is probably still some Evolution syncing going on here. Are there any drawbacks of checking the "Use WebDAV Method" box?

dmfs commented 9 years ago

@bascht It's slightly less efficient than what it does now, because it always syncs the entire calendar (even events way back in the past). But the server doesn't have to parse the calendar data, because it doesn't need to filter. So it's more robust on the server side when it comes to broken calendar data.

bascht commented 9 years ago

@dmfs Yep, the Evolution thing was a pretty good hint. I found & deleted that calendar entry and now the next one pops up:

DateTimeZone::__construct(): Unknown or bad timezone (W. Europe Standard Time) at \/var\/www\/owncloud\/3rdparty\/sabre\/vobject\/lib\/Sabre\/VObject\/TimeZoneUtil.php#412

@nickvergessen @MorrisJobke should I open a new issue? Looks like this is a regression in 8.0.3.

nickvergessen commented 9 years ago

Yes new issue please

geez0x1 commented 9 years ago

I can confirm seeing this error, example:

Error PHP DateTimeZone::__construct(): Unknown or bad timezone (W. Europe Standard Time) at /usr/share/owncloud/3rdparty/sabre/vobject/lib/Sabre/VObject/TimeZoneUtil.php#412 2015-05-31T08:11:25+00:00

On (Server: 8.0.2, Clients: 1.8.0) as well as now with (Server: 8.0.3, Clients 1.8.1). I have never used Evolution. I use Thunderbird/Lightning and Android CalDAV-Sync for syncing Calendars generally.

tzdata reports this:

:/# dpkg-reconfigure tzdata

Current default time zone: 'Europe/Amsterdam'
Local time is now:      Thursday 7 May  15:32:25 CEST 2015.
Universal Time is now:  Thu May  7 13:32:25 UTC 2015.

For some reason phpinfo reports Europe/Berlin (although that is the same timezone), without manually setting date.timezone, that is:

date
date/time support   enabled
"Olson" Timezone Database Version   0.system
Timezone Database   internal
Default timezone    Europe/Berlin 

Slightly more info in my comments in https://github.com/owncloud/client/issues/3020