WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#46791 reopened defect (bug)

esc_url() adding http:// to a relative URL to parent directory '../pathname/'

Reported by: OrangePixelNath Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.1
Component: Formatting Keywords: has-patch needs-testing
Focuses: Cc:

Description

esc_url() adds 'http://' when it shouldn't.

Line 4191 wp-includes/formatting.php states

If the URL doesn't appear to contain a scheme, we presume it needs http:// prepended (unless a relative link starting with /, # or ? or a php file).

This is prepending http:// to a relative url to a parent directory i.e. ../path-to-page/

Funtion needs ../ adding to the array or some regex code.

Attachments (2)

46791.diff (633 bytes) - added by subrataemfluence 3 years ago.
Proposed patch.
46791-2.diff (782 bytes) - added by subrataemfluence 3 years ago.
Corrected patch.

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Formatting

@subrataemfluence
3 years ago

Proposed patch.

@subrataemfluence
3 years ago

Corrected patch.

#2 @OrangePixelNath
2 years ago

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

#3 @OrangePixelNath
2 years ago

  • Keywords needs-patch added

#4 follow-up: @desrosj
2 years ago

  • Keywords has-patch added; needs-patch removed

@OrangePixelNath did you mean to close this ticket? If so, can you detail why? What did you discover that made your report incorrect or unnecessary?

#5 in reply to: ↑ 4 @OrangePixelNath
2 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Replying to desrosj:

@OrangePixelNath did you mean to close this ticket? If so, can you detail why? What did you discover that made your report incorrect or unnecessary?

No sorry. I'm new to the system so didn't understand what was next.

#6 @desrosj
2 years ago

  • Keywords needs-testing added

No problem! That’s why I checked to be sure :)

Next, the ticket stays open for community members to text and review.

Last edited 2 years ago by desrosj (previous) (diff)
Note: See TracTickets for help on using tickets.