The gmap_sanitize function is incompatible with some older installs of PHP from what I can tell, is a result of differences in the way they supports this crazy do loop and the key and current functions. The glitch results from the condition if (key($gmap)=='id') always returning true and causes the id, under some conditions, to be replaced with a numeric value not supported as a variable name by javascript. I've updated the function locally and it works fine everywhere I've tested it replacing the following code.

before:

$value=current($gmap);
do {
  if (key($gmap)=='id') {
    $out = array();
    preg_match('([a-zA-Z1-9_-]*)', $value, $out);
    if (strlen($out[0])==0) $out[0]='map';
    $gmap[key($gmap)]=$out[0];
  }
  else {
    $gmap[key($gmap)]=str_replace(';','',$value);
  }
} while ($value=next($gmap));

after:

foreach ($gmap as $key=>$value) {
  if ($key=='id') {
    $out = array();
    preg_match('([a-zA-Z1-9_-]*)', $value, $out);
    if (strlen($out[0])==0) $out[0]='map';
    $gmap[$key]=$out[0];
  }
  else {
    $gmap[$key]=str_replace(';','',$value);
  }
}

Comments

webgeer’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the code

Anonymous’s picture

Status: Fixed » Closed (fixed)