From: Skizzerz Date: Wed, 4 Jun 2014 02:40:03 +0000 (-0500) Subject: Fix PHP notice when logging the result of a DNS blacklist check. X-Git-Tag: 1.31.0-rc.0~9863^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=8e8826b7685fef51d11b7d510c5e20e76482d24b;p=lhc%2Fweb%2Fwiklou.git Fix PHP notice when logging the result of a DNS blacklist check. When the array syntax is used for the DNS blacklist, PHP throws a notice about array to string conversion. This change ensures that the correct string name is used regardless of what type of blacklist entry is used. Change-Id: I2511a8320474a02d8f321d04f005bb9d18fb15b3 --- diff --git a/includes/User.php b/includes/User.php index 22c90cdd16..d57dfaac15 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1694,6 +1694,7 @@ class User implements IDBAccessObject { foreach ( (array)$bases as $base ) { // Make hostname // If we have an access key, use that too (ProjectHoneypot, etc.) + $basename = $base; if ( is_array( $base ) ) { if ( count( $base ) >= 2 ) { // Access key is 1, base URL is 0 @@ -1701,6 +1702,7 @@ class User implements IDBAccessObject { } else { $host = "$ipReversed.{$base[0]}"; } + $basename = $base[0]; } else { $host = "$ipReversed.$base"; } @@ -1709,11 +1711,11 @@ class User implements IDBAccessObject { $ipList = gethostbynamel( $host ); if ( $ipList ) { - wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!" ); + wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $basename!" ); $found = true; break; } else { - wfDebugLog( 'dnsblacklist', "Requested $host, not found in $base." ); + wfDebugLog( 'dnsblacklist', "Requested $host, not found in $basename." ); } } }