WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#31249 assigned defect (bug)

PHP notice when viewing autosave

Reported by: iseulde Owned by: adamsilverstein
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Revisions Keywords: needs-patch
Focuses: Cc:

Description

Notice: Undefined offset: 2 in wp-admin/includes/revision.php on line 223

This happens when you view an autosave without any previous revisions and the original author's role is not author anymore.

Change History (3)

#1 @adamsilverstein
3 years ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

@iseulde Thanks for the bug report!

I will look into this, can you clarify the steps to reproduce? is this right?

  • Open an existing post without previous revisions (the default hello post, or can you also create a new post?)
  • ensure autosave fires
  • change role to contributor
  • edit the post and go to revisions screen

#2 @iseulde
3 years ago

Those sound like good steps to reproduce the issue. This happened to me when I imported the theme unit test data. A post was autosaved (no revisions) and when I came back later and clicked on "view autosave", I save the notice. Very minor issue I guess.

#3 @adamsilverstein
3 years ago

Ok, thanks. Will investigate.

Revisions incorrectly makes the assumption that there is always a saved revision, which is true when creating new posts, but false after an import or on a new install (sample posts).

Related #29044

Note: See TracTickets for help on using tickets.