From e382dfcfbd6f5aebfb0b25ab0ceb05056b69857a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20M=C3=BCller?= <marcusmueller@protonmail.com>
Date: Thu, 12 Apr 2018 19:14:53 +0200
Subject: [PATCH] [BUGFIX] DB: Don't check DNS on IPs

Fixes https://github.com/friendica/friendica/issues/4786
---
 include/dba.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/dba.php b/include/dba.php
index 586fc092fb..4252558346 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -52,7 +52,8 @@ class dba {
 		}
 
 		if ($install) {
-			if (strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
+			// server has to be a non-empty string that is not 'localhost' and not an IP
+			if (strlen($server) && ($server !== 'localhost') && filter_var($server, FILTER_VALIDATE_IP) === false) {
 				if (! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) {
 					self::$error = L10n::t('Cannot locate DNS info for database server \'%s\'', $server);
 					return false;