Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#7486 closed enhancement (fixed)

When looking for rewrite rules matches, change preg_match start/end character from ! to % or #

Reported by: aesqe's profile aesqe Owned by: jacobsantos's profile jacobsantos
Milestone: 2.8 Priority: lowest
Severity: trivial Version: 2.6
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

In classes.php, around line 100 (lines 104 and 105 in WP 2.6, class WP) when trying to find rewrite rule matches, ! (exclamation mark) is used as start/end for regexp in the preg_match function. Should be changed to % or # to enable use of, for example, (?!) in rules.

Attachments (2)

7486.r10258.diff (595 bytes) - added by jacobsantos 15 years ago.
Patch is based off of r10258
7486.diff (559 bytes) - added by jacobsantos 15 years ago.
Patch based off of 10569 that uses '#' instead of '!'

Download all attachments as: .zip

Change History (9)

@jacobsantos
15 years ago

Patch is based off of r10258

#1 @jacobsantos
15 years ago

  • Keywords has-patch commit needs-testing added; regexp rewrite rules removed
  • Milestone changed from 2.9 to 2.8

Has patch, sending to 2.8.

#2 follow-up: @DD32
15 years ago

  • Keywords needs-patch added; has-patch commit needs-testing removed
  • Version set to 2.6

preg_quote() is not the answer, that escapes all content within it, so as to render any rules useless.

would anyone have a need to use # in a rewrite rule?

#3 in reply to: ↑ 2 @mrmist
15 years ago

Replying to DD32:

would anyone have a need to use # in a rewrite rule?

Only if you were doing non-escaped redirection on an anchor. I guess it would be pretty rare.

#4 @DD32
15 years ago

Only if you were doing non-escaped redirection on an anchor. I guess it would be pretty rare.

Does the Anchor even get sent -to- the server? I dont think it does?

Eitherway, It needs to use something as a delim. I would think # wouldnt be used within a URL (assuming its not sent to the server, and i'm pretty sure it isnt) in order to prevent confusing browsers, else it'd have to be escaped.. and that would just be plain ugly..

@jacobsantos
15 years ago

Patch based off of 10569 that uses '#' instead of '!'

#5 @jacobsantos
15 years ago

  • Keywords has-patch commit added; needs-patch removed

#6 @jacobsantos
15 years ago

  • Owner changed from anonymous to jacobsantos

#7 @westi
15 years ago

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

(In [10573]) Use # as the delimiter for preg_match in rewrite rules to allow them to contain !. Fixes #7486 props jacobsantos.

Note: See TracTickets for help on using tickets.