com web/php: Fix a warning with the new example files: include/ip-to-country.inc

From: Date: Wed, 04 Dec 2013 06:42:12 +0000
Subject: com web/php: Fix a warning with the new example files: include/ip-to-country.inc
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-17334@lists.php.net to get a copy of this message
Commit: 0344cc1f94162bc76c85be8def22224e9ffb9d10 Author: Hannes Magnusson <bjori@mongodb.com> Tue, 3 Dec 2013 22:42:12 -0800 Parents: a96814d7363e04b480853a89c9a929d46fe07903 Branches: master Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=0344cc1f94162bc76c85be8def22224e9ffb9d10 Log: Fix a warning with the new example files Changed paths: M include/ip-to-country.inc Diff: diff --git a/include/ip-to-country.inc b/include/ip-to-country.inc index e45d404..86f8074 100644 --- a/include/ip-to-country.inc +++ b/include/ip-to-country.inc @@ -98,6 +98,10 @@ function i2c_search_in_index($ip) // Read in granularity from index file and // convert current IP to something useful $granularity = intval(fgets($dbidx, 64)); + if (!$granularity) { + // The file is empty (demo file) + return false; + } $ip_chunk = intval($ip / $granularity); // Loop till we can read the file

« previous php.webmaster (#17334) next »