Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken PHP function timezone_name_from_abbr affects roundcube #4289

Closed
rcubetrac opened this issue Jul 24, 2013 · 5 comments
Closed

Broken PHP function timezone_name_from_abbr affects roundcube #4289

rcubetrac opened this issue Jul 24, 2013 · 5 comments
Assignees
Milestone

Comments

@rcubetrac
Copy link

Reported by mgrum on 24 Jul 2013 11:41 UTC as Trac ticket #1489261

When detecting the client timezone, the Javascript sometimes send a numerical time offset (i.e. the difference to UTC) instead of a string containing the timezone name. When Roundcube sees these numerical values (coming either directly from the Javascript or from the database), it uses the PHP function timezone_name_from_abbr to get the timezone names (in rcube_config.php).

This function however doesn't work for some specific offsets, simply because they are not present in the functions built-in conversion table. This is a known PHP bug and has been reported at [https://bugs.php.net/bug.php?id=44780]. It is still not fixed, after more than five years, so we probably can't expect it to be fixed anytime soon.

Roundcube seemingly tries to work around this bug by ignoring exceptions and falling back to the server timezone (since commit 086b153), but that is obviously not always the correct timezone for the user.

A proper workaround would be to throw out timezone_name_from_abbr and use an own conversion table, which is more complete than the built-in one. The data for such a table was posted in the PHP bug report comments by mfburdett.

Migrated-From: http://trac.roundcube.net/ticket/1489261

@rcubetrac
Copy link
Author

Comment by @alecpl on 28 Jul 2013 12:09 UTC

Since we use jsTimezoneDetect numeric timezone shouldn't be returned from javascript in all browsers except IE6. So, maybe we shouldn't care. Or this is jsTimezoneDetect bug?[[BR]]
As for the timezone_name_from_abbr() bug http://php.net/manual/en/function.timezone-name-from-abbr.php#86928 gives another solution.

@rcubetrac
Copy link
Author

Milestone changed by @alecpl on 28 Jul 2013 12:09 UTC

later => 1.0-beta

@rcubetrac
Copy link
Author

Comment by mgrum on 30 Jul 2013 12:30 UTC

I looked further into this and I don't think that there is a jsTimezoneDetect bug involved here. As far as I can tell, the Javascript really only sends numeric values if it runs in IE6 (which I can understand if you don't care for).

I think the real problem is that after an upgrade from a previous version of Roundcube, that did not use jsTimezoneDetect, there are many useres who have numeric timezone values stored in the database. And those users will be affected by the timezone_name_from_abbr bug every time the timezone setting is read from the database.

A possible fix for that is writing a separate script that changes these values directly in the database (which is what we did).

@rcubetrac
Copy link
Author

Comment by @alecpl on 8 Sep 2013 10:38 UTC

Fixed in 8eb0850.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 8 Sep 2013 10:38 UTC

new => closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants