S3 backup list times are shifted by the site's UTC offset (timezone offset applied twice)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 95
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Backups stored on an S3 (or S3-compatible) destination are listed in the Backups History table with a time shifted into the future by the site's UTC offset. On a UTC+9 (Asia/Tokyo) site, a scheduled backup that ran at 0:00 JST is shown as "9:00 AM", and a manual backup taken at 1:40 PM is shown as "10:40 PM". Backups stored on the local folder destination show the correct time, so S3 rows look inconsistent next to them.
Cause
BackWPup_Destination_S3::file_update_list() converts the S3 object's LastModified (UTC) into a Unix timestamp and then adds the site's gmt_offset:
$changetime = strtotime((string) $object['LastModified']) + (get_option('gmt_offset') * 3600);
Unix timestamps are timezone-independent, and all three consumers of this value format it with wp_date(), which already converts the epoch to the site timezone:
- the backups history table:
components/table-row-backups.php(lines 9-10) - the legacy backups page:
BackWPup_Page_Backups::column_time() - the S3 file list (download/restore view):
$files[$filecounter]['time']within the same method
The offset is therefore applied twice.
To Reproduce
- Set the site timezone to a non-UTC zone (e.g. Asia/Tokyo, UTC+9) in Settings → General.
- Configure a job with an S3 (or S3-compatible, e.g. Cloudflare R2) destination and run it.
- Open BackWPup → Backups History: the row shows the backup 9 hours in the future, while the filename (which uses site-local time) and a backup stored on the server show the correct time.
Expected behavior
The S3 backup rows show the actual backup time in the site timezone, matching backups stored on the local folder destination.
Environment
- BackWPup 5.7.4
- WordPress with PHP 8.4
- Destination: Cloudflare R2 (S3-compatible)
Additional context
Proposed fix in #239: drop the gmt_offset addition and keep the true epoch.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in BackWPup_Destination_S3::file_update_list() and inspect how LastModified becomes $changetime, then trace its use in components/table-row-backups.php, BackWPup_Page_Backups::column_time(), and the S3 file list. Reproduce with a non-UTC site timezone and confirm all three views show the actual backup time once in the site timezone, matching local-folder backups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, php
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100