WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#32376 closed defect (bug) (fixed)

Urls are encoded incorrectly in WP_Posts_List_Table::get_views()

Reported by: BdN3504 Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.2.2
Component: Posts, Post Types Keywords: has-patch needs-docs
Focuses: administration Cc:

Description

I stumbled upon this bug when I tried to fix something else: The current css class is not added to the 'All' link in the views. To solve this issue, I added the css class with DOMDocument. But when I called the method to read the html of

$views['all']

like so:

DOMDocument::loadHTML($views['all'])

, I received a parsing error. The parsing error is thrown because the ampersand in WP_Posts_List_Table::get_views() on line 185 is not encoded.
I will refrain from using my DOMDocument method of fixing the other bug, I will file another bug instead, because I now know why the 'current' css class is not added to the 'All' view.

Attachments (2)

class-wp-posts-list-table.patch (703 bytes) - added by BdN3504 6 years ago.
A patch fixing the issue.
32376.diff (7.1 KB) - added by wonderboymusic 5 years ago.

Download all attachments as: .zip

Change History (7)

@BdN3504
6 years ago

A patch fixing the issue.

#1 @BdN3504
6 years ago

  • Keywords has-patch added

@wonderboymusic
5 years ago

#2 @wonderboymusic
5 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to wonderboymusic
  • Status changed from new to assigned

I did some work here. See 32376.diff

#3 @wonderboymusic
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34084:

WP_Posts_List_Table: there are a cadre of edit.php URLs that are generated by string-building instead of using our handy functions. Create a helper method, ->get_edit_link() that standardizes the generation and escaping of these URLs.

Props BdN3504 for the initial patch on the ticket.
Fixes #32376.

#4 @DrewAPicture
5 years ago

  • Keywords needs-docs added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Documentation for this new method is incomplete:

  • Need docs for all three parameters, including marking the third one optional
  • The summary needs a period and should not contain markdown backticks
  • Needs an @access tag

#5 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 34238:

Docs: Expand the DocBlock for the WP_Theme::get_edit_link() method, introduced in [34084].

Fixes #32376.

Note: See TracTickets for help on using tickets.