WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#3963 closed defect (bug) (fixed)

EP_ALL constant in wp-includes/rewrite.php doesn't encompass all values

Reported by: jhodgdon Owned by:
Milestone: 2.2 Priority: low
Severity: minor Version: 2.1.2
Component: General Keywords: rewrite has-patch
Focuses: Cc:

Description

In wp-includes/rewrite.php, there are a bunch of constants used in the add_rewrite_endpoint function (and perhaps elsewhere) to indicate which rewrite rules to add endpoints for. One of them, EP_ALL, looks like it was meant to encompass all the individual places you could add endpoints, but its value doesn't work. It should be 4095 instead of 255 in order to encompass everything.

It is perhaps possible that the behavior was intentional, to have EP_ALL only stand for the constants above that are less than 255, but when I was writing a plugin to use the add_rewrite_endpoints, I naively first used EP_ALL, and then realized it didn't work for everything and substituted the value 4095 in my function call. So I think the name EP_ALL is confusing if it is not supposed to encompass everything.

It is easy for someone calling the function to type in the value of 4095 if they really want to get endpoints on everything, so it's a fairly low priority fix, but I will attach a (very simple) patch. If the 255 behavior was intentional and not an oversight, ignore this ticket; perhaps it would be nice to add a comment to the code noting that EP_ALL does not actually encompass everything, however.

Also note that EP_ALL is never used in WordPress source code. But changing it would affect any plugins that might have used it in their code.

Current rewrite.php version I am referencing is [4990].

Attachments (2)

rewrite-php.diff (524 bytes) - added by jhodgdon 11 years ago.
Patch to change the value of EP_ALL to 4095
rewrite-php-alt.diff (592 bytes) - added by jhodgdon 11 years ago.
Alternative patch that leaves value of EP_ALL alone but adds comment to avoid confusion

Download all attachments as: .zip

Change History (7)

@jhodgdon
11 years ago

Patch to change the value of EP_ALL to 4095

@jhodgdon
11 years ago

Alternative patch that leaves value of EP_ALL alone but adds comment to avoid confusion

#1 @foolswisdom
11 years ago

  • Milestone changed from 2.3 to 2.2

#2 @rob1n
11 years ago

Hey, how do you do your patches? I see your path as E:\Eclipse\- and so on. I'm not sure if this works.

#3 @foolswisdom
11 years ago

  • Milestone changed from 2.2 to 2.3

#4 @ryan
10 years ago

  • Milestone changed from 2.3 to 2.2

#5 @ryan
10 years ago

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

(In [5131]) Set EP_ALL to 4095. Props jhodgdon. fixes #3963

Note: See TracTickets for help on using tickets.