diff --git a/src/Http/ServerRequest.php b/src/Http/ServerRequest.php index 06cdbbf655c..3ee99c8956d 100644 --- a/src/Http/ServerRequest.php +++ b/src/Http/ServerRequest.php @@ -590,12 +590,8 @@ public function clientIp() $n = count($addresses); if ($trusted) { - for ($i = 1; $i < $n; $i++) { - if (in_array($addresses[$i], $this->trustedProxies) === false) { - $trusted = false; - break; - } - } + $trusted = array_diff($addresses, $this->trustedProxies); + $trusted = (count($trusted) === 1); } if ($trusted) {