|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch patch-geoip_record_by_name for geoip Bug #68277Patch version 2014-10-23 02:47 UTC Return to Bug #68277 | Download this patchThis patch is obsolete Obsoleted by patches: Patch Revisions:Developer: phpbugs@joern.heissler.de
--- php-geoip-1.1.0.orig/geoip-1.1.0/geoip.c
+++ php-geoip-1.1.0/geoip-1.1.0/geoip.c
@@ -538,7 +538,7 @@ PHP_FUNCTION(geoip_netspeedcell_by_name)
Returns the detailed City information found in the GeoIP Database */
PHP_FUNCTION(geoip_record_by_name)
{
- GeoIP * gi;
+ GeoIP * gi = NULL;
char * hostname = NULL;
int arglen;
GeoIPRecord * gir;
@@ -547,13 +547,13 @@ PHP_FUNCTION(geoip_record_by_name)
return;
}
- if (GeoIP_db_avail(GEOIP_CITY_EDITION_REV1) || GeoIP_db_avail(GEOIP_CITY_EDITION_REV0)) {
- if (GeoIP_db_avail(GEOIP_CITY_EDITION_REV1)) {
- gi = GeoIP_open_type(GEOIP_CITY_EDITION_REV1, GEOIP_STANDARD);
- } else {
- gi = GeoIP_open_type(GEOIP_CITY_EDITION_REV0, GEOIP_STANDARD);
- }
- } else {
+ if (GeoIP_db_avail(GEOIP_CITY_EDITION_REV1)) {
+ gi = GeoIP_open_type(GEOIP_CITY_EDITION_REV1, GEOIP_STANDARD);
+ }
+ if (! gi && GeoIP_db_avail(GEOIP_CITY_EDITION_REV0)) {
+ gi = GeoIP_open_type(GEOIP_CITY_EDITION_REV0, GEOIP_STANDARD);
+ }
+ if (! gi) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Required database not available at %s.", GeoIPDBFileName[GEOIP_CITY_EDITION_REV0]);
return;
}
|
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |