#31249 closed defect (bug) (fixed)
PHP notice when viewing autosave
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Revisions | Keywords: | has-patch commit |
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.
Attachments (1)
Change History (11)
#2
@
10 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
@
10 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
This ticket was mentioned in PR #953 on WordPress/wordpress-develop by adamsilverstein.
4 years ago
#5
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/31249
adamsilverstein commented on PR #953:
4 years ago
#6
#7
@
4 years ago
This is still reproducible and was also reported to me by another user.
It can easily happen when you:
- import posts into WordPress (for example the test data @iseulde mentioned) and then
- trigger an autosave by making a small edit and waiting until the autosave triggers, then
- Reload the post and click the link to "View the Autosave".
Because the post is imported, the expected "initial" post revision is missing. Revisions takes care of this, but a bug meant the "author" it tried to use did not exist. We can just use the revision author here instead.
31249.diff fixes the issue.
Before this fix, I also saw a JavaScript error viewing these autosaves, after the fix the screen worked as expected.
hellofromtonya commented on PR #953:
4 years ago
#10
Closed with changeset https://core.trac.wordpress.org/changeset/50128
@iseulde Thanks for the bug report!
I will look into this, can you clarify the steps to reproduce? is this right?