#23187 closed defect (bug) (fixed)
esc_url() fails if the URL's scheme's case does not match the allowed protocol's case
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Steps to reproduce:
$url = esc_url( 'HTTP://example.com' ); var_dump( $url );
Expected output:
string(18) "http://example.com"
Actual output:
string(0) ""
From http://tools.ietf.org/html/rfc3986:
Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. An implementation should accept uppercase letters as equivalent to lowercase in scheme names (e.g., allow "HTTP" as well as "http") for the sake of robustness but should only produce lowercase scheme names for consistency.
Patch and unit tests attached.
Attachments (2)
Change History (12)
#4
@
12 years ago
In 1184/tests:
#5
in reply to:
↑ 2
@
12 years ago
Replying to alexvorn2:
I think It should validate only for lower case http not HtTp
It's completely case-insensitive, so both of those are equivalent, but the canonical form should always be 'http'.
(From memory, there may be further code in SimplePie_IRI
that can be ripped out for this, but that's fairly heavy.)
I think It should validate only for lower case http not HtTp