From 8e8826b7685fef51d11b7d510c5e20e76482d24b Mon Sep 17 00:00:00 2001 From: Skizzerz Date: Tue, 3 Jun 2014 21:40:03 -0500 Subject: [PATCH] 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 --- includes/User.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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." ); } } } -- 2.20.1