Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#40164 new defect (bug)

Apace HTTP 414 error on deleting comments in bulk

Reported by: garethgillman's profile garethgillman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.3
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

Bit of an edge case, but I just had to delete 3000 comments from a WP site I took on and I was doing them in 200's (so not to over run the server and so I can check for any legitimate comments).

Doing this, the first 200 comments were "spanmmed" fine, but then you do the next 200, it generates a 414 error as the url becomes something like:

/wp-admin/edit-comments.php?s=&comment_status=moderated&pagegen_timestamp=2017-03-15+15%3A31%3A06&_total=200&_per_page=200&_page=1&paged=1&_ajax_fetch_list_nonce=ef4afc8347&_wp_http_referer=%2Fnew-site%2Fwp-admin%2Fedit-comments.php%3Fcomment_status%3Dmoderated%26paged%3D1%26spammed%3D200%26ids%3D814%2C365%2C2177%2C813%2C2021%2C812&_wpnonce=461233332d&_wp_http_referer=%2Fnew-site%2Fwp-admin%2Fedit-comments.php%3Fcomment_status%3Dmoderated%26paged%3D1%26spammed%3D200%26ids%3D814%2C365%2C2177%2C813

Basically for every process it duplicates the url and if you have 100+ ID's in each request, it passes a really long url string

1) Is there a reason why all the comment ID's are passed to the url?
2) Can this be amended so in edge cases, so the 414 error isn't generated as it can and will frustrate some people.

Attachments (1)

40164.diff (757 bytes) - added by bor0 8 years ago.

Download all attachments as: .zip

Change History (3)

#1 @bor0
8 years ago

Steps to reproduce:

Test case prerequisites:

  • Create 400 comments programatically:
    <?php
    $data = array(
        'comment_post_ID' => 1,
        'comment_author' => 'admin',
        'comment_author_email' => 'admin@admin.com',
        'comment_author_url' => 'http://localhost/',
        'comment_content' => 'Comment content goes here',
        'user_id' => 1,
        'comment_author_IP' => '127.0.0.1',
        'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
        'comment_date' => current_time('mysql'),
        'comment_approved' => 0,
    );
     
    for ( $i = 0; $i < 400; $i++ ) {
        wp_insert_comment( $data );
    }
    
  1. Case 1 (fixed by not appending ids in the $trashed || $spammed case):
  • Navigate to wp-admin/edit-comments.php
  • Using the screen options, set Number of items per page: 200
  • Click on Pending (400)
  • Select Comments and click on Filter.
  • Bulk select all and apply Mark as Spam action.
  • Repeat 6.

Error shows:

Request-URI Too Long

The requested URL's length exceeds the capacity limit for this server.
  1. Case 2 (fixed by making the form post instead of get):
  • Navigate to wp-admin/edit-comments.php
  • Using the screen options, set Number of items per page: 400
  • Click on Pending (400)
  • Select Comments and click on Filter.
  • Bulk select all and apply Mark as Spam action.

Error shows:

Request-URI Too Long

The requested URL's length exceeds the capacity limit for this server.
Last edited 8 years ago by bor0 (previous) (diff)

@bor0
8 years ago

#2 @bor0
8 years ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.