[wp-trac] [WordPress Trac] #23923: wp_get_post_revisions returns incorrect order

WordPress Trac noreply at wordpress.org
Wed Apr 3 12:07:19 UTC 2013


#23923: wp_get_post_revisions returns incorrect order
-----------------------------+--------------------------
 Reporter:  kovshenin        |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Revisions
  Version:                   |   Severity:  minor
 Keywords:  needs-patch      |
-----------------------------+--------------------------
 When a post has multiple revisions and each revision has the exact same
 timestamp, `wp_get_post_revisions` returns revisions in reversed order,
 causing `wp_save_post_revision` to
 [http://core.trac.wordpress.org/browser/trunk/wp-
 includes/revision.php#L116 make a bad choice] for `$last_revision` (which
 is actually the first revision) and produce an extra revision, even if it
 has not been changed.

 In a normal environment this doesn't happen, unless you run
 `wp_update_post` several times in a row in under one second, so this is an
 edge case. This edge case causes our
 [http://core.trac.wordpress.org/browser/tests/trunk/tests/post/revisions.php#L55
 revisions.php tests] to fail randomly, depending on whether the updates
 happened with the same timestamp or not.

 To reproduce, try running the revisions unit tests several times in a row.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23923>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list