akalongman / akalongman/php-ip-tools
isRemote() is not the same as !isLocal()
オープン
- 主要言語
- PHP
- スター
- 147
- フォーク
- 10
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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);
```
コントリビューションガイド
評価
この issue はまだ評価されていません。