Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36674 closed enhancement (fixed)

Make WP->parse_request() variables more self-descriptive

Reported by: ericlewis's profile ericlewis Owned by: ericlewis's profile ericlewis
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords:
Focuses: Cc:

Description

The variable names $req_uri and $request make WP->parse_request() a bit hard to follow.

Attachments (1)

36674.diff (2.4 KB) - added by ericlewis 8 years ago.

Download all attachments as: .zip

Change History (7)

#1 @ericlewis
8 years ago

This is related to my question in #18877

The fact that the function requires $request and $request_uri is confusing. I wonder if we can boil the function input down to $request.

We can't boil down the function input to $request, because the rewrite matching engine needs to know what the requested filename as well as the URL path in the case of PATH_INFO links.

@ericlewis
8 years ago

#2 @ericlewis
8 years ago

  • Keywords has-patch added

In attachment:36674.diff, I suggest using the names $requested_file and $requested_path for clarity.

#3 @ericlewis
8 years ago

  • Milestone changed from Awaiting Review to 4.6

#4 @ericlewis
8 years ago

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

In 37356:

Rewrite Rules: Add self-describing variables to rewrite matcher.

The rewrite rule matching code in WP::parse_request() used an unclear variable $request to represent the requested path (e.g. "2016/05/03") as well as a deceptively named variable $request_uri, which actually represents the requested file when an install used PATHINFO links.

Those variables are replaced with $requested_path and $requested_file respectively for clarity.

Fixes #36674.

#5 @ericlewis
8 years ago

  • Keywords has-patch removed

#6 @DrewAPicture
8 years ago

In 37366:

Docs: Remove backticks from the DocBlock summary for WP::$request, added in [37356].

Markdown formatting is not supported in DocBlock summaries, per the inline documentation standards for PHP :-)

See #32246. See #36674.

Note: See TracTickets for help on using tickets.