itbdw / ip-database

免费IP离线数据库,支持IPV4+IPV6 ,国家、省、市、县、运营商
Other
1.37k stars 259 forks source link

An exception occurrs when querying few specfic IP #25

Closed dennytang closed 3 years ago

dennytang commented 3 years ago

Hi,Master Thx for your project, it really helps. Rectently, using the tool, I found an issue attached the related logs as follow.
An exception occurrs when encountering the specfic IP 111.12.25.35 as input. FYI, after I tested some cases, I found the exception occurrs whenever IP involes IP subnet 111.12.. .

### normal test case result is fine php D:\SRC_Code\PHP_Project\ip-database-2.0.9\tests\ip.php -i 36.147.19.241 {"ip":"36.147.19.241","country":"中国","province":"北京","city":"","county":"","isp":"移动","area":"中国北京移动"}

### err log ### php D:\SRC_Code\PHP_Project\ip-database-2.0.9\tests\ip.php -i 111.12.25.35 Fatal error: Uncaught Error: Call to undefined function itbdw\Ip\mb_stripos() in D:\SRC_Code\PHP_Project\ip-database-2.0.9\src\IpLocation.php:276 Stack trace:

0 D:\SRC_Code\PHP_Project\ip-database-2.0.9\src\IpLocation.php(171): itbdw\Ip\IpLocation->getAddr('111.12.25.35')

1 D:\SRC_Code\PHP_Project\ip-database-2.0.9\tests\ip.php(43): itbdw\Ip\IpLocation::getLocation('111.12.25.35')

2 {main}

thrown in D:\SRC_Code\PHP_Project\ip-database-2.0.9\src\IpLocation.php on line 276

image

itbdw commented 3 years ago

Well, PHP extension mbstring is required.

It was lists at composer.json

"require": {
    "php": "*",
    "ext-mbstring": "*",
    "ext-json": "*",
    "ext-iconv": "*"
  }