When calling the "nearbypostalcodes" service, using the postcode+country+radius variant:

    $query = array('postalcode' => 8775, 'country' => 'CH', 'radius' => 10);
    $results = geonames_query('nearbypostalcodes', $query);

the following messages are emitted at Notice level:

Undefined index: lat	Notice	geonames.module	600	geonames_query_required_parameters_set()	
Undefined index: lng	Notice	geonames.module	600	geonames_query_required_parameters_set()	
CommentFileSizeAuthor
#2 geonames.warning.patch895 byteslyricnz

Comments

lyricnz’s picture

The code in question is:

        foreach ($rp as $param) {
          if ($query[$param]) {
            $count = $count + 1;
          }
        }

This should use array_key_exists() rather than checking for a non-false array value (consider a zero value!).

lyricnz’s picture

StatusFileSize
new895 bytes

See attached patch

lyricnz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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