Opened 14 years ago
Closed 9 years ago
#16993 closed defect (bug) (fixed)
wp-mail.php doesn't account for half-hour and quarter-hour timezones.
Reported by: | neoscrib | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Keywords: | has-patch commit | |
Focuses: | Cc: |
Description
To reproduce the problem, install Wordpress and set it to post by email. Send a post from an email address which is configured to use a half-hour or quarter-hour timezone (like Afghanistan, +0430).
wp-mail.php calculates the timezone by multiplying the timezone offset by 36. This works fine for whole-hour timezones (Pacific Time -0800, -800 * 36 = -28800 seconds). For half-hour and quarter-hour time zones this does not work (Afghanistan +0430, 430 * 36 = 15480, should be 16200). The reason this happens is because an hour has 60 minutes as opposed to 100 minutes. 430 / 100 = 4.3 hours, not 4.5 hours. 450 * 36 result in 16200 minutes, but timezones are represented as hours and minutes, not fractional hours.
This results in posts that are posted via email from a half-hour or quarter-hour timezone to be posted in the future or in the past from when it was actually posted.
Attachments (2)
Change History (12)
#2
follow-up:
↓ 3
@
14 years ago
The current logic is replicating what PHP's strtotime()
would do internally - I don't see the point. We can just use strtotime, which can handle RFC822 timestamps (including timezone offsets). It doesn't like parenthesised timezone strings (after the +0000 bit), so we should remove those, but otherwise it works for every email header date I've seen.
#3
in reply to:
↑ 2
@
14 years ago
Replying to solarissmoke:
The current logic is replicating what PHP's
strtotime()
would do internally - I don't see the point. We can just use strtotime, which can handle RFC822 timestamps (including timezone offsets). It doesn't like parenthesised timezone strings (after the +0000 bit), so we should remove those, but otherwise it works for every email header date I've seen.
That makes more sense!
Use strtotime instead of regex parsing