[wp-trac] [WordPress Trac] #26042: wp_save_post_revision() can compare against the wrong $last_revision post
WordPress Trac
noreply at wordpress.org
Mon Nov 25 23:24:47 UTC 2013
#26042: wp_save_post_revision() can compare against the wrong $last_revision post
----------------------------+------------------------------
Reporter: wonderboymusic | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Revisions | Version:
Severity: normal | Resolution:
Keywords: has-patch |
----------------------------+------------------------------
Comment (by nunomorgadinho):
The problem seems to be in wp-includes/revision.php (around line 95) in
that last_revision is wrongly set when posts are added within milliseconds
of each other:
{{{
if ( $revisions = wp_get_post_revisions( $post_id ) ) {
// grab the last revision, but not an autosave
foreach ( $revisions as $revision ) {
if ( false !== strpos( $revision->post_name,
"{$revision->post_parent}-revision" ) ) {
$last_revision = $revision;
break;
}
}
}}}
How about grabbing the last element of the revisions array as the
last_revision, wouldn't that work?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26042#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list