URL Called:

http://127.0.0.1/admin/config/content/location/geocoding
Fatal error: Call to a member function asXML() on a non-object in sites\all\modules\location\geocoding\google.inc on line 37

Comments

WorldFallz’s picture

I have this error in the lastest d6 dev as well-- wrapping that statement in an 'is_object' check fixes it. don't know what other downstream effects it might have though.

frederickjh’s picture

@WorldFallz

Can you show the code that you used to fix this? I am having the same problem, but can not quite understand exactly how you fixed this.

Thanks!

Frederick

WorldFallz’s picture

I no longer have access to the site, but I would think I changed that line from:

cache_set('location_google', $xml->asXML());

to

if (is_object($xml)) {
  cache_set('location_google', $xml->asXML());
}
podarok’s picture

Version: 7.x-4.x-dev » 7.x-3.x-dev

7.x-4.x unsupported and old version
please, use 7.x-3.x

frederickjh’s picture

I am not going to change the version of this issue but to clarify I am having the same problems with the 6.x-3.3 version.

wouters_f’s picture

Issue summary: View changes

I had this issue when behind a Proxy that did not allow access..
This code allows the developer to see more information in the log.
In my case squid returns usefull info in the html.
With this watchdog behind "$xml = simplexml_load_string"

if($xml == false) {
        watchdog('location_geocode', 'could not fetch data from spreadsheets.google.com <pre>:data</pre>', array(':data' => print_r($source, true)), WATCHDOG_ERROR)    ;
}

You can see whats going on in the watchdog.
*Edit typo

pog21’s picture

I'm getting the same error. (7.x-3.x-dev). But I'm not behind a proxy or anything else I can think of.

pog21’s picture

Adding the code in #6 bore the following in the logs:

could not fetch data from spreadsheets.google.com

stdClass Object
(
    [request] => GET /feeds/list/p9pdwsai2hDMsLkXsoM05KQ/default/public/values HTTP/1.0
User-Agent: Drupal (+http://drupal.org/)
Host: spreadsheets.google.com


    [data] => You do not have view access to the spreadsheet. Make sure that you are properly authenticated.
    [protocol] => HTTP/1.0
    [status_message] => Forbidden
    [headers] => Array
        (
            [content-type] => text/html; charset=UTF-8
            [set-cookie] => NID=67=aOYUdz6tXtyP-UmwgG1wQuP8LIQNNmIB0wvxCGa6jHFBVaMMJUr2TOZ9ZklvoEYd6Nqs-BCTOhxXmB-P3ug4O4Zu4onSAD3T1Hluh4wOgI_Bbl8WEk0b7VvzVOlfwluT;Domain=.google.com;Path=/;Expires=Thu, 16-Jul-2015 21:28:23 GMT;HttpOnly
            [p3p] => CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
            [x-chromium-appcache-fallback-override] => disallow-fallback
            [date] => Wed, 14 Jan 2015 21:28:23 GMT
            [expires] => Wed, 14 Jan 2015 21:28:23 GMT
            [cache-control] => private, max-age=0
            [x-content-type-options] => nosniff
            [x-frame-options] => SAMEORIGIN
            [x-xss-protection] => 1; mode=block
            [server] => GSE
            [alternate-protocol] => 80:quic,p=0.02
            [accept-ranges] => none
            [vary] => Accept-Encoding
        )

    [code] => 403
    [error] => Forbidden
)

As you can see it's showing a 403 forbidden response, but I have no idea why this would be.

I also tried the (d6) fix in #3 but get the following error on the geocoding options page:

    Notice: Trying to get property of non-object in google_geocode_country_list() (line 62 of sites/all/modules/location/geocoding/google.inc).
    Warning: Invalid argument supplied for foreach() in google_geocode_country_list() (line 62 of sites/all/modules/location/geocoding/google.inc).
djdevin’s picture

egfrith’s picture

Status: Active » Closed (duplicate)

I've posted a potential fix for this issue at #2406483-12: Gecoding options crash in geocoding/google.inc.

System Lord’s picture

I installed that patch and here is what I get back in error:

Notice: Undefined variable: countries in google_geocode_country_list() (line 15 of 

/home/xxxxx/xxxxx/site/sites/all/modules/location/geocoding/google.inc).

Warning: array_keys() expects parameter 1 to be array, null given in google_geocode_country_list() (line 15 of 

/home/xxxxx/xxxxx/site/sites/all/modules/location/geocoding/google.inc).

Line 15 is:
return array_keys($countries);
...from the patch.

Then this line for every country I assume:

Warning: in_array() expects parameter 2 to be array, null given in location_geocoding_options_form() (line 246 of /home/xxxxx/xxxxx/site/sites/all/modules/location/location.admin.inc).

I'm curious, and can't find anything on it, but what is the purpose of the "Geocoding Options"? Does any of this affect how Location module functions? Even with these errors I can still see all the countries and all say: "No service selected for country." UPDATE: Ha, I just found info in the documentation and Yes this is important. So, still an even bigger issue is why are they all: "None supported." and "No service selected for country." I definitely cant find info on how to get this working properly.

Note: I'm using the Dev which is why i posted here and not at the issue #240648-12 above. I also tried the stable release and get the same warning/errors.

Additional info:
What I describe above is on a new install of D734. I also have a site that is a year old and D734 and both are setup identically as for the Location module settings and use. I do not have any errors/warnings coming from this old site and can access "Geocoding Options" without issue. That's just strange.

Chetna_Negi’s picture

#3 worked for me on my 2 projects, thanks WorldFallz.