[wp-trac] [WordPress Trac] #31632: Don't strip newline in esc_url() when protocol is mailto:
WordPress Trac
noreply at wordpress.org
Fri Mar 13 17:28:05 UTC 2015
#31632: Don't strip newline in esc_url() when protocol is mailto:
-----------------------------+----------------------------
Reporter: danielbachhuber | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Formatting | Version:
Severity: normal | Keywords:
Focuses: |
-----------------------------+----------------------------
`esc_url()` strips encoded newlines when it shouldn't.
The genesis of newline stripping is r4148. `mailto` was added as a
mentioned protocol in r8743, but it doesn't appear there was any technical
change, only the PHPdoc mention.
Here's the failing testcase:
{{{
$body = <<<EOT
Hi there,
I thought you might want to sign up for this newsletter
EOT;
$email_link = 'mailto:?body=' . rawurlencode( $body );
// Expected:
mailto:?body=Hi%20there%2C%0A%0AI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter
var_export( $email_link );
// Actual:
mailto:?body=Hi%20there%2CI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter
$email_link = esc_url( $email_link );
var_export( $email_link );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31632>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list