[wp-trac] [WordPress Trac] #38271: `wp-remove-post-lock` Ajax request generates notice in `wp_ajax_wp_remove_post_lock()`

WordPress Trac noreply at wordpress.org
Sun Oct 9 15:58:59 UTC 2016


#38271: `wp-remove-post-lock` Ajax request generates notice in
`wp_ajax_wp_remove_post_lock()`
----------------------------------------+-----------------------------
 Reporter:  dlh                         |      Owner:
     Type:  defect (bug)                |     Status:  new
 Priority:  normal                      |  Milestone:  Awaiting Review
Component:  Editor                      |    Version:  trunk
 Severity:  normal                      |   Keywords:
  Focuses:  javascript, administration  |
----------------------------------------+-----------------------------
 Before [38425], when no `#active_post_lock` was in the DOM, the POST
 request from `post.js` with the `wp-remove-post-lock` action would not
 include an `active_post_lock` key, and `wp_ajax_wp_remove_post_lock()`
 would return immediately.

 After [38425], when no `#active_post_lock` is in the DOM,
 `active_post_lock` is converted to the string "undefined" when `formData`
 is supported (I'm using Chrome 53.0.2785.143).

 `wp_ajax_wp_remove_post_lock()` tries to process that value, leading to
 `Undefined offset: 1` after `array_map( 'absint', explode( ':',
 $_POST['active_post_lock'] ) )`.

 To replicate, visit `post-new.php` and refresh the page after it loads.

 The attached patch would return before the Ajax request occurs in
 `post.js` if `data.active_post_lock` is undefined.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38271>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list