From: Niklas Laxström Date: Wed, 5 Dec 2007 22:07:08 +0000 (+0000) Subject: 2 PHP Notice: Undefined offset: 1 in /var/www/w/includes/GlobalFunctions.php on... X-Git-Tag: 1.31.0-rc.0~50532 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=b8aab1c088a64a9eb7f7a818c041f5867320bd5e;p=lhc%2Fweb%2Fwiklou.git 2 PHP Notice: Undefined offset: 1 in /var/www/w/includes/GlobalFunctions.php on line 1986 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1aa48346d6..e70bc46082 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1976,13 +1976,19 @@ function wfMakeUrlIndex( $url ) { // Reverse the labels in the hostname, convert to lower case // For emails reverse domainpart only if ( $bits['scheme'] == 'mailto' ) { - $mailparts = explode( '@', $bits['host'] ); - $domainpart = strtolower( implode( '.', array_reverse( explode( '.', $mailparts[1] ) ) ) ); + $mailparts = explode( '@', $bits['host'], 2 ); + if ( count($mailparts) === 2 ) { + $domainpart = strtolower( implode( '.', array_reverse( explode( '.', $mailparts[1] ) ) ) ); + } else { + // No domain specified, don't mangle it + $domainpart = ''; + } $reversedHost = $domainpart . '@' . $mailparts[0]; } else { $reversedHost = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) ); } // Add an extra dot to the end + // Why? Is it in wrong place in mailto links? if ( substr( $reversedHost, -1, 1 ) !== '.' ) { $reversedHost .= '.'; }