Rasmus Vind
Well-known member
I started using XenForo_Helper_Ip in my code and I came across this:
As you can see, if the clearLoginAttempts actually gets an ipAddress as input, it will pass it as a Zend_Controller_Request_Http. That does not sound right to me. At the very least, the $ipAddress needs to be renamed to $request. I see no place in the codebase where the $ipAddress is ever set, but it is still wrong at some level.
In many other places, you call it with a null at its first argument, but seems like it was forgotten here.
PHP:
// XenForo_Model_Login:
public function clearLoginAttempts($usernameOrEmail, $ipAddress = null)
{
$ipAddress = XenForo_Helper_Ip::getBinaryIp($ipAddress);
// ...
}
public function countLoginAttempts($usernameOrEmail, $ipAddress = null)
{
$ipAddress = XenForo_Helper_Ip::getBinaryIp($ipAddress);
// ...
}
// XenForo_Helper_Ip:
public static function getBinaryIp(Zend_Controller_Request_Http $request = null, $ip = null, $invalidValue = false)
{
// ...
}
As you can see, if the clearLoginAttempts actually gets an ipAddress as input, it will pass it as a Zend_Controller_Request_Http. That does not sound right to me. At the very least, the $ipAddress needs to be renamed to $request. I see no place in the codebase where the $ipAddress is ever set, but it is still wrong at some level.
In many other places, you call it with a null at its first argument, but seems like it was forgotten here.