Opened 7 years ago
Closed 4 months ago
#47307 closed defect (bug) (worksforme)
wp_insert_post: status 'future' is saved although 'publish' selected
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.1 |
| Component: | Posts, Post Types | Keywords: | has-patch |
| Focuses: | administration | Cc: |
Description
If I change the title of the page using the customizer, the changes are not saved because the changeset post is saved with status 'future' although 'publish' selected.
I debugged the issue and found the following fragment of code of wp_insert_post is causing the issue:
<?php if ( mysql2date( 'U', $post_date_gmt, false ) > mysql2date( 'U', $now, false ) ) { $post_status = 'future'; }
This piece of code has no sense, because when the status is set as "publish", we don't want to change artificially to "future" because the publish date is now.
It seems an issue with some versions of PHP/MYSQL, since is working on my local host (Windows) but not on the production server (PHP7.0, Ubuntu).
I debugged the components of the comparison:
$now => 2019-05-17 16:32:59 $post_date_gmt => 2019-05-17 18:32:59 mysql2date( 'U', $post_date_gmt, false ) => 1558110779 mysql2date( 'U', $now, false ) => 1558103579
The date/time configuration of the server is:
root@srvde1 ~ # date Fri May 17 18:33:24 CEST 2019
There are other affected users over the years, searching on the Internet "customizer does not save changes".
Attachments (1)
Change History (2)
#1
@
4 months ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
- Version changed from 5.2 to 2.1
Reproduction Report
Description
❌ This report can't validate that the issue can be reproduced.
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.29
- Server: nginx/1.29.1
- Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
- Browser: Chrome 140.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty 2.9
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Testing Instructions
- Change the timezone in Settings > General
- Confirm that the server has the same timezone with
date - Change the title of the site in the Customizer
- 👌 Title is changed correctly, the
futureassignment is not triggered.
Actual Results
- ❌ Error condition does not occur anymore.
Fix patch (V. 5.2)