I'm hosting in AWS and we keep getting errors like the ones below;

Notice: Undefined property: stdClass::$data in hostip_get_iptocountry_info() (line 128 of /sites/all/modules/hostip/hostip.module).

Notice: Undefined index: HostipLookupResultSet in hostip_get_iptocountry_info() (line 132 of /sites/all/modules/hostip/hostip.module).

Notice: Undefined index: HostipLookupResultSet in hostip_get_iptocountry_info() (line 133 of /sites/all/modules/hostip/hostip.module).

Notice: Undefined index: HostipLookupResultSet in hostip_get_iptocountry_info() (line 134 of /sites/all/modules/hostip/hostip.module).

On investigation, I can see that the following line returns an empty object;

From hostip.module (line 113)

  $ip_details = drupal_http_request($url);

In my case, we have the server locked down for testing so our load balancer allows no response. We should also be considering a NULL response if the hostip.info service is unavailable. In my case I get a "Connection timed out" error with a response code of -110.

Something to check the object has been populated would be fantastic? (Not tested as I don't really know a lot about the module, but can investigate further and maybe roll a patch if required?)

if(drupal_http_request($url)){
    $ip_details = drupal_http_request($url);
}else{
    $ip_details = 'set something as a default object here, or mayeb an error message?';
}

Thanks,

Mark

Comments

amitgoyal’s picture

Status: Active » Fixed

Thanks Mark. We have added extra checks to avoid notices/errors.

This has been fixed in 7.x-1.3.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.