Closed (fixed)
Project:
GMap Module
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 May 2006 at 20:09 UTC
Updated:
2 Jun 2006 at 07:00 UTC
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
Comment #1
webgeer commentedThanks for the code
Comment #2
(not verified) commented