[wp-trac] [WordPress Trac] #47307: wp_insert_post: status 'future' is saved although 'publish' selected
WordPress Trac
noreply at wordpress.org
Fri May 17 16:55:15 UTC 2019
#47307: wp_insert_post: status 'future' is saved although 'publish' selected
-------------------------------+-----------------------------
Reporter: daniol | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 5.2
Severity: normal | Keywords: has-patch
Focuses: administration |
-------------------------------+-----------------------------
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
<?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 at 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".
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47307>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list