Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#7486 closed enhancement (fixed)

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

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

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 18 years ago.
Patch is based off of r10258
7486.diff​ (559 bytes ) - added by jacobsantos 18 years ago.
Patch based off of 10569 that uses '#' instead of '!'

Download all attachments as: .zip

Change History (9)

@jacobsantos
18 years ago

Patch is based off of r10258

#1 @jacobsantos
18 years ago

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

Has patch, sending to 2.8.

#2 follow-up: @DD32
18 years ago

  • Keywords needs-patch added; has-patch commit needs-testing removed
  • Version → 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
18 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
18 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
18 years ago

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

#5 @jacobsantos
18 years ago

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

#6 @jacobsantos
18 years ago

  • Owner changed from anonymous to jacobsantos

#7 @westi
18 years ago

  • Resolution → fixed
  • Status new → 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.