Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 2 years ago

#18260 closed defect (bug) (fixed)

Don't prepend scheme to urls staring with a question mark in esc_url()

Reported by: ryan Owned by: ryan
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.2.1
Component: Formatting Keywords:
Focuses: Cc:


The scheme is not prepended for other relative urls. It should not be prepended here either.

Attachments (2)

18260.diff (860 bytes) - added by ryan 4 years ago.
18260.2.diff (849 bytes) - added by ryan 4 years ago.

Download all attachments as: .zip

Change History (7)

4 years ago

#1 @nacin
4 years ago

Looks good. Code wise, another option: ! in_array( $url[0], array( '/', '#', '?' ) ).

Not sure if the in_array() will be faster, but array access should be faster than substr, especially if limited to one time.

4 years ago


#2 @ryan
4 years ago

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

In [18469]:

Recognize urls that start with a question mark as relative urls that do not require a scheme to be prepended. fixes #18260

#4 @downloadbook
4 years ago

download free ebook for computer

Version 0, edited 4 years ago by downloadbook (next)

#5 @SergeyBiryukov
2 years ago

#16945 was marked as a duplicate.

Note: See TracTickets for help on using tickets.