You have a defect in core/LimitLoginAttempts.php
-
As stated, you have a defect in core/LimitLoginAttempts.php, specifically in your is_ip_valid function. It fails to recognize an ip address that also contains a port designation, for example nnn.nnn.nnn.nnn:pppp as being valid. Furthermore, your code in function get_address should detect that a port designation is present on an ip address and should probably strip that portion of the address of before returning the result.
I corrected your code locally by changing the is_ip_valid function to be:
public function is_ip_valid( $ip ) { if( empty( $ip ) ) return false; $local_ip = parse_url( "https://" . $ip . "/index.php", PHP_URL_HOST); if ( filter_var($local_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ) { return true; } if ( filter_var($local_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ) { return true; } return false; }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘You have a defect in core/LimitLoginAttempts.php’ is closed to new replies.