akalongman / akalongman/php-ip-tools
isRemote() is not the same as !isLocal()
Aperta
- Lingua principale
- PHP
- Stelle
- 147
- Fork
- 10
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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);
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.