Opened 18 years ago
Closed 16 years ago
#5459 closed defect (bug) (duplicate)
autosave creates new draft on each iteration
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3.1 |
Component: | Administration | Keywords: | autosave has-patch |
Focuses: | Cc: |
Description
Expected behaviour: on each auto-save the current post is saved
Current behaviour for some users:
For some users (I can't reproduce) every time a draft is auto-saved it fails with errors like:
Warning: Invalid argument supplied for foreach() in .../blog/wp-admin/admin-functions.php on line 30 Warning: array_search() [function.array-search]: Wrong datatype for second argument in .../blog/wp-admin/admin-functions.php on line 117 Warning: Illegal string offset: -1197443547 in .../blog/wp-admin/admin-functions.php on line 124
As a result on each auto-save a new draft is created.
Cause: somehow the autosave_draft_ids
options is both true and not an array and the default value isn't used:
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) $draft_ids = array();
Solution: if $draft_ids
isn't tested in boolean, but in array context everything is fine:
if ( !is_array( $draft_ids = get_user_option( 'autosave_draft_ids' ) ) ) $draft_ids = array();
Patch-attached.
Thanks to Krasimir Dobrev for experiencing and reporting this one.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
This can happen on some php versions that incorrectly process charsets. It's related to things getting unsuccessfully unserialized, and it has been fixed in r10955