jenkins-bot has submitted this change and it was merged. Change subject: (bug 45069) wfParseUrl() no longer produces a PHP notice if passed a "mailto:" URL without address ......................................................................
(bug 45069) wfParseUrl() no longer produces a PHP notice if passed a "mailto:" URL without address Calling wfParseUrl( 'mailto:' ) or wfParseUrl( 'mailto:?subject=...' ) was resulting in the following PHP errors: PHP Notice: Undefined index: path in includes/GlobalFunctions.php on line 813 PHP Notice: Undefined index: path in includes/GlobalFunctions.php on line 814 Now the existence of that key is checked and if missing an empty string is set so for consistency of the returned value. The fix is based on the snippet provided on https://www.mediawiki.org/wiki/Thread:Project:Support_desk/GLobafunctions.php_wfParseUrl_choking_on_url Change-Id: Ife07d6e2a364a7cafda387cf7ed9cd71c2b68ef8 --- M RELEASE-NOTES-1.21 M includes/GlobalFunctions.php 2 files changed, 10 insertions(+), 3 deletions(-) Approvals: Martineznovo: Looks good to me, but someone else must approve Hashar: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 7e06218..f49a4b0 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -169,6 +169,8 @@ * (bug 43964) Invalid value of "link" parameter in <gallery> no longer produces a fatal error. * (bug 44775) The username field is not pre-filled when creating an account. +* (bug 45069) wfParseUrl() no longer produces a PHP notice if passed a "mailto:" + URL without address === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat. diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 3fa816f..739003a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -809,9 +809,14 @@ if ( !isset( $bits['host'] ) ) { $bits['host'] = ''; - /* parse_url loses the third / for file:///c:/ urls (but not on variants) */ - if ( substr( $bits['path'], 0, 1 ) !== '/' ) { - $bits['path'] = '/' . $bits['path']; + // bug 45069 + if ( isset( $bits['path'] ) ) { + /* parse_url loses the third / for file:///c:/ urls (but not on variants) */ + if ( substr( $bits['path'], 0, 1 ) !== '/' ) { + $bits['path'] = '/' . $bits['path']; + } + } else { + $bits['path'] = ''; } } -- To view, visit https://gerrit.wikimedia.org/r/49642 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ife07d6e2a364a7cafda387cf7ed9cd71c2b68ef8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: IAlex <[email protected]> Gerrit-Reviewer: Aaron Schulz <[email protected]> Gerrit-Reviewer: Hashar <[email protected]> Gerrit-Reviewer: Martineznovo <[email protected]> Gerrit-Reviewer: Parent5446 <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
