When an error occurs at the server site (eg: calling the commercial web-service without a valid account) some error XML is returned:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<geonames>
<status message="Please provide a valid username for the commercial GeoNames web service or use the free ws.geonames.org server. Thank you for your understanding." value="10"/>
</geonames>

This message is not returned to the user.

CommentFileSizeAuthor
#2 geonames.status.patch690 byteslyricnz

Comments

lyricnz’s picture

There is some code that looks like it intended to handle this case:

  $xml = new SimpleXMLElement($data);
  if (isset($xml) && is_array($xml->status)) {

but this doesn't work because $xml->status is not an array but a SimpleXMLElement.

lyricnz’s picture

StatusFileSize
new690 bytes

To check for the existence of a child, typecast it to a bool. Here's a patch that does that.

lyricnz’s picture

Status: Active » Fixed

Applied.

Status: Fixed » Closed (fixed)

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