Page MenuHomePhabricator

PHP Notice: Undefined index: path in wfParseUrl function in mailto:?subject= URLs
Closed, ResolvedPublic

Description

According to the forum thread linked from this bug, when inserting a mailto: url without email address but with a query string it gives a PHP notice.

For example:

mailto:?subject=Visit%20this%20website!&body=asdad

This URL syntax makes the mail program to create a new message without TO: address but with the subject and body defined, useful to give users an easy way to generate an email template for sharing.

This is the solution proposed on the forum thread: "Testing for isset( $bits['path'] ) at GlobalFunctions.php line 755 corrects the error."

/* parse_url loses the third / for file:///c:/ urls (but not on variants) */
if ( isset( $bits['path'] ) ) { /* new */

if ( substr( $bits['path'], 0, 1 ) !== '/' ) {
    $bits['path'] = '/' . $bits['path'];
}

} else { /* new */

$bits['path'] = '';

}


Version: 1.20.x
Severity: trivial
URL: https://www.mediawiki.org/wiki/Thread:Project:Support_desk/GLobafunctions.php_wfParseUrl_choking_on_url

Details

Reference
bz45069