WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 7 months 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:
PR Number:

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 8 months ago.
Proposed patch.
46791-2.diff (782 bytes) - added by subrataemfluence 8 months ago.
Corrected patch.

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
8 months ago

  • Component changed from General to Formatting

@subrataemfluence
8 months ago

Proposed patch.

@subrataemfluence
8 months ago

Corrected patch.

#2 @OrangePixelNath
7 months ago

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

#3 @OrangePixelNath
7 months ago

  • Keywords needs-patch added

#4 follow-up: @desrosj
7 months 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
7 months 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
7 months 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 7 months ago by desrosj (previous) (diff)
Note: See TracTickets for help on using tickets.