Skip to content

Commit

Permalink
Improved comparison of the condition
Browse files Browse the repository at this point in the history
  • Loading branch information
batumibiz committed Jan 20, 2024
1 parent 0493119 commit eda0430
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Http/IpAndUserAgentMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ public function determineIpViaProxyAddress(ServerRequestInterface $request): ?st
foreach ($this->headersToInspect as $header) {
if (
$request->hasHeader($header)
&& preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $request->getHeaderLine($header), $vars)
&& preg_match_all(
'#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s',
$request->getHeaderLine($header),
$vars
) !== false
&& null !== ($ip = $this->extractIp($request, $vars))
) {
return $ip;
Expand Down

0 comments on commit eda0430

Please sign in to comment.