gmap_geocode() calls drupal_urlencode() but drupal_urlencode() does not seem to be defined in 7.

Fatal error: Call to undefined function drupal_urlencode() in {...}/sites/all/modules/gmap/gmap.module on line 1178

Comments

hutch’s picture

Does replacing it with urlencode() make it work properly?

Clive@onebrick.org’s picture

Yes. Replacing the call with urlencode() solves the problem.

hutch’s picture

StatusFileSize
new587 bytes

Here is a patch on current 7.x-1.x

damiankloip’s picture

I found the same problem/fix. This patch needs to be committed but I don't think it has yet? apologies if I'm wrong...

hutch’s picture

Status: Active » Needs review

Setting this issue to 'Needs Review' for patch in #3

phoenix’s picture

drupal_urlencode is drupal_encode_path in drupal 7.
See here on api.drupal.org (comment #1): http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ur...

damiankloip’s picture

Good spot @phoenix. Patch in #3 is not applicable, uses php urlencode function. Just change that for drupal_encode_path instead...

damiankloip’s picture

Status: Needs review » Active
hutch’s picture

Status: Active » Needs review
StatusFileSize
new596 bytes

Here is a patch as per #7, I can't test at the moment, rebuilding server.
Should work...

damiankloip’s picture

Looks good to me, how wrong can a one liner go ;)

nclavaud’s picture

Status: Needs review » Reviewed & tested by the community

#9 works here too

heavy_engineer’s picture

#9 is fine for me too thanks.

calmforce’s picture

I added this tiny function to my module, and everything works:

function drupal_urlencode($address) {
return drupal_encode_path($address);
}

With this function present no need to patch GMap module.

Two obvious questions come to mind:

1. Without a patch (or the function that I suggest) the gmap_geocode function is useless. The change is so simple, why GMap 7.x-1.x-dev has not been fixed yet?

2. Question to Drupal core guys: why to change the API function name, so some modules have to be patched? Sounds like unnecessary change without respect to backwards compatibility...

haiiro.shimeji’s picture

Status: Reviewed & tested by the community » Fixed

patch #9 is applied to 7.x-1.x branch. Thanks a lot!

Status: Fixed » Closed (fixed)

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