I upgraded to the latest dev release but now when I save a node to geocode it I get the following error:

I'm using the Google maps API with a free key.

Warning: call_user_func() expects parameter 1 to be a valid callback, function 'geocoder_google_field' not found or invalid function name in geocoder_widget_get_field_value() (line 297 of /code/sites/all/modules/contrib/geocoder/geocoder.widget.inc).

I will try to figure this out later but I'm noting this now in case anyone else runs into the same issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ptmkenny created an issue. See original summary.

jasom’s picture

I confirm that after dev update Google geocoder doesn't work.

Fatal error: Call to undefined function geocoder_google_form() in /path/to/site/sites/all/modules/geocoder/geocoder.widget.inc on line 135

URL with error: admin/structure/types/manage/contenttypename/fields/field_geofield_ad

I use Geolocation module to get lat and long from geocoder field in field field_geofield_ad.

Also important to mention: I have multilingual site. On english version (main language) is everything OK. When I switch to Czech or German version Geocoder doesn't work.

Here is the latest working dev release from November 20, 2015 10:14.

erwangel’s picture

Same here with 7.x-1.2+35-dev (2016-jan-07)
Warning : call_user_func() expects parameter 1 to be a valid callback, function 'geocoder_google_field' not found or invalid function name dans geocoder_widget_get_field_value() (line 297 of /path-to/sites/all/modules/geocoder/geocoder.widget.inc).

jasom’s picture

Here's the latest working DEV.

Simon Georges’s picture

Assigned: Unassigned » Pol

@Pol, since you've done the majority of the recent commits, does it remind you of something?

jasom’s picture

- Who broke the module? Who was that?!
- Pol! He did it!

:)

Plazik’s picture

Priority: Normal » Critical

@jasom thanks for this version.
I've also had to run drush rr to make it works.

Because this breaks module functionality I've marked it as "Critical".

Pol’s picture

Hi all,

First, this is the development channel of the module, so, you might expect things to break.
Second, I'm very sorry for this, I will fix what I broke for sure.
Third, the function is still in the module, I need to figure out why it's not more available.

I'll fix this for today I think.

rudiedirkx’s picture

Status: Active » Needs review
FileSize
560 bytes

Adding

        include $handler['path'] . '/' . $handler['file'];

before line 145 fixes it for me, but it seems very unlikely someone removed something like that... The fix does make sense though, because the handler has to include itself, kinda.

Patch attached for just that.

rudiedirkx’s picture

It looks like 44c79b5 broke it, which makes sense, because caching it, means the file isn't included anymore. I think #9 fixes it decently, but there might be a ctools include function to do that correctly.

rudiedirkx’s picture

FileSize
565 bytes

Actually, that should be a require_once instead of an include.

Pol’s picture

rudiedirkx’s picture

FileSize
1.43 KB

Not good enough. Needs more inclusion, for all callbacks.

Now with handler include helper. Last time.

The ctools function looks... HUGE for just including 1 file. I don't know what ctools expects. Maybe there's more important logic in ctools_plugin_load_includes(), but it seems excessive.

rudiedirkx’s picture

And what is this?!?

    $cache = cache_get("ctools_plugin_files:$info[module]:$info[type]");

Should that make the string

    "ctools_plugin_files:" . $info['module'] . ":" . $info['type']

because it's missing a few quotes then. Or is it supposed to make

    "ctools_plugin_files:" . $info . "[module]:" . $info . "[type]"

because that's concatting arrays into strings...

I don't trust ctools =) never have.

Pol’s picture

CTools is not perfect indeed... but it helped us a lot.

I think we should use api functions for now as much as possible, we'll have more options in Geocoder 2.x.

With ctools_plugin_load_includes(), does it works ?

rudiedirkx’s picture

I haven't tried. I didn't know it existed until now. I might tomorrow.

Pol’s picture

Status: Needs review » Needs work

Ok, let me know if it works then, I'll commit it asap after that.

  • Pol committed 88a0c1d on 7.x-1.x
    Issue #2647536: Latest dev release breaks Google geocoder.
    
Pol’s picture

Status: Needs work » Fixed

Hi all, I've fixed it.

Sorry for that.

In the meantime, you can have a look at Geocoder 2.x @ http://github.com/drupol/geocoder

rudiedirkx’s picture

Status: Fixed » Needs work

I'm still getting this, when saving a new field (in POSTback). The URL is /admin/config/people/accounts/fields/field_geostuffs?destinations[0]=admin/config/people/accounts/fields and I just confirm-saved the new field. When I go back one page, it's still broken.

In geocoder_get_handler() is apparently not enough.

Error:

Fatal error: Call to undefined function geocoder_google_form() in geocoder.widget.inc on line 146

MXT’s picture

Just upgraded to latest 7.x-1.x-dev.

Google geocoding is not working now, simple address are not geocoded:

The address Milano could not be geocoded to a location.

And I get this warning:

Warning: call_user_func() expects parameter 1 to be a valid callback, function 'geocoder_google' not found or invalid function name in geocoder() (line 57 of /var/www/mysite/sites/all/modules/contrib/geocoder/geocoder.module).

  • Pol committed 1602b85 on 7.x-1.x
    Follow up issue #2647536: Latest dev release breaks Google geocoder.
    
Pol’s picture

Hi,

I've updated again, can you try and give me feedback please ?

rudiedirkx’s picture

Nope. Still fails on the widget form. It's not that hard =) Line 146. $settings_callback is a function. It doesn't exist. #13 does that. I'm not sure if #22 did anything, I don't know how geocoder() would be called.

Pol’s picture

Oh I didn't see that patch!

Can you please reroll it and remove the useless require_once ?

Thanks !

rudiedirkx’s picture

No, you're almost there! =) Just add the handler function on 1 more location (psst line 146) and we're done, I think. #22 was useful. There are 3 locations (so far) that require the explicit handler include/load, not just 2 like I thought.

Pol’s picture

Voila, done.

Sorry, for the bug :(

  • Pol committed 2fa52a5 on 7.x-1.x
    Follow up issue #2647536: Latest dev release breaks Google geocoder.
    
rudiedirkx’s picture

Nope.

Warning: Illegal offset type in isset or empty in geocoder_get_handler() (line 134 of geocoder.module).

and then a

Fatal error: Call to undefined function geocoder_google_form() in geocoder.widget.inc on line 149

Go home Pol, you're drunk =)

Pol’s picture

Shit... I think I've fixed it.

  • Pol committed b86c82e on 7.x-1.x
    Follow up issue #2647536: Latest dev release breaks Google geocoder.
    
rudiedirkx’s picture

Status: Needs work » Fixed

Yes, I think that was it! I'm proud of you man. Time for weekend.

Pol’s picture

Geez, I really needed some sleep :-)

Status: Fixed » Closed (fixed)

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