akalongman / akalongman/php-ip-tools
isRemote() is not the same as !isLocal()
Offen
- Vorherrschende Sprache
- PHP
- Sterne
- 147
- Forks
- 10
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
When passing an empty string as the IP like this:
```php
$ip = '';
$is_remote = Ip::isRemote($ip);
```
it returns `true`, even thought the IP itself is invalid.
This is because `isLocal()` returns `false` (due to the IP being invalid), and `isRemote()` simply switches the result to `true`.
Workaround:
```php
$ip = '';
$is_remote = Ip::isValid($ip) && Ip::isRemote($ip);
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.