Skip to content

Commit 9f34f02

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: added missing translations for Bosnian (bs) Add the missing greek translations for security core and validator component Do not call substr_count() if ip is null to avoid deprecation warning in PHP 8.1 [Security][Validator] Add missing translations for Slovenian (sl) [Security][Validator] Add missing translations for Finnish (fi) [Cache] Commit items implicitly only when deferred keys are requested [HttpClient] fix missing kernel.reset tag on TraceableHttpClient services
2 parents 51addc7 + b9a9110 commit 9f34f02

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

IpUtils.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ private function __construct()
3636
*/
3737
public static function checkIp(?string $requestIp, $ips)
3838
{
39+
if (null === $requestIp) {
40+
return false;
41+
}
42+
3943
if (!\is_array($ips)) {
4044
$ips = [$ips];
4145
}

Tests/IpUtilsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function getIpv4Data()
3939
[true, '1.2.3.4', '192.168.1.0/0'],
4040
[false, '1.2.3.4', '256.256.256/0'], // invalid CIDR notation
4141
[false, 'an_invalid_ip', '192.168.1.0/24'],
42+
[false, '', '1.2.3.4/1'],
43+
[false, null, '1.2.3.4/1'],
4244
];
4345
}
4446

@@ -69,6 +71,8 @@ public function getIpv6Data()
6971
[false, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '1a01:198:603:0::/65']],
7072
[false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'],
7173
[false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'],
74+
[false, '', '::1'],
75+
[false, null, '::1'],
7276
];
7377
}
7478

0 commit comments

Comments
 (0)