akalongman / akalongman/php-ip-tools
isRemote() is not the same as !isLocal()
Đang mở
- Ngôn ngữ chính
- PHP
- Star
- 147
- Fork
- 10
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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);
```
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.