Closed (fixed)
Project:
Google Maps Tools
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jan 2010 at 17:57 UTC
Updated:
17 Feb 2010 at 16:10 UTC
I always get the above warning when saving a node containing a "GMaps Point" field.
I don't get the warning when saving nodes containing "GMaps Address and Point" fields.
Any idea?
Comments
Comment #1
xmarket commentedCan you provide more info (file + line no, field settings + widget input settings, new/existing node)?
Comment #2
thommyboy commentedsure, sorry i didn't do it right away...
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/vhostsDOMAIN/subdomains/travel/httpdocs/includes/database.mysql.inc on line 321.
It happens when creating a new node AND updating an existing one.
Field type is "GMaps Point" and settings are "Enable geocoder", "Use input map", "Collapsible", "Collapsed: when not empty", "Disable numeric"
The rest ist standards.
As I mentioned- another Contenttype containing "GMaps Address and Point" works fine
Comment #3
lyricnz commentedThat file+line is actually not much use, since that's just the underlying mysql library. Is there anything more useful in the error log? Alternatively, can you modify database.mysql.inc to provide a backtrace() so we can tell where (in geonames) the bad SQL is coming from?
Comment #4
thommyboy commentednothing in the php error log :( but it's simply reproduceable- I just created a new content type containing only one
"GMaps Point" field and get the same behaviour. But of course it could be something special in my configuration. I did
have "minor" problems installing the module- when I edited the map preset "Input Earth" after installing (just changed
the size of the map) and wanted to save it, I got errors because some fields (e.g. optional settings/table of contents map/
grid settings/number of columns) are "required" but were empty after installing the module (no default value) could
this be a problem? but shouldn't have to do with the mentioned sql-error...
Comment #5
thommyboy commentedHello again, I inserted the following into database.mysql.inc function db_escape_string()
if( is_array($text)) {
die( var_dump($text) . "DB: " . $active_db);
The result is
array(2) { ["query"]=> string(0) "" ["domain"]=> string(2) "de" } Text: DB: Resource id #7
Does this help?
Comment #6
lyricnz commentedLooks like a problem with a translation of some text to German. It would be more directly useful if you could provide a backtrace at that point.
Comment #7
thommyboy commentedI've done some more testing. It seems it's a combination of two settings for a "GMaps Point" field:
- Field settings/GMaps settings/Input settings for this field: "disable numeric input fields" (everything else is checked)
- Global settings/Gmaps settings for this field: "enable bounds" (everything else is unchecked too)
Both settings unchecked: error
"enable bounds" checked, "disable numeric input fields" unchecked: fine
Both settings checked: fine
"enable bounds" unchecked, "disable numeric input fields" checked: error
(So it seems "enable bounds needs to be checked?)
Backtrace (part of, it's very long...) for the last setting, generated in
function db_escape_string($text)
{
global $active_db;
if(is_array($text))
die(debug_print_backtrace());
return mysql_real_escape_string($text, $active_db);
}
#0 db_escape_string(Array ([query] => 06179 Teutschenthal, Germany,[domain] => de)) called at [/var/www/vhosts/MYSITE/httpdocs/includes/database.inc:225] #1 _db_query_callback(Array ([0] => %s,[1] => %s)) #2 preg_replace_callback(/(%d|%s|%%|%f|%b|%n)/, _db_query_callback, INSERT INTO gmaps_content_point (vid, nid, field_name, delta, map_type, latitude, longitude, elevation, x, y, z, search) VALUES (%d, %d, '%s', %d, '%s', %n, %n, %n, %f, %f, %f, '%s')) called at [/var/www/vhosts/MYSITE/httpdocs/includes/database.mysql-common.inc:41] #3 db_query(INSERT INTO {gmaps_content_point} (vid, nid, field_name, delta, map_type, latitude, longitude, elevation, x, y, z, search) VALUES (%d, %d, '%s', %d, '%s', %n, %n, %n, %f, %f, %f, '%s'), Array ([0] => 10150,[1] => 1856,[2] => field_lonlat,[3] => 0,[4] => earth,[5] => 51.45274,[6] => 11.810997,[7] => 0,[8] => 3898439.594363,[9] => 815207.3932104,[10] => 4965087.563669,[11] => Array ([query] => 06179 Teutschenthal, Germany,[domain] => de))) called at [/var/www/vhosts/MYSITE/httpdocs/includes/common.inc:3467] #4 drupal_write_record(gmaps_content_point, stdClass Object ([search] => Array ([query] => 06179 Teutschenthal, Germany,[domain] => de),[latitude] => 51.45274,[longitude] => 11.810997,[elevation] => 0,[map_type] => earth,[z] => 4965087.563669,[y] => 815207.3932104,[x] => 3898439.594363,[vid] => 10150,[nid] => 1856,[field_name] => field_lonlat,[delta] => 0)) called at [/var/www/vhosts/MYSITE/httpdocs/sites/all/modules/gmaps/modules/gmaps_content/includes/gmaps_content.node-form.inc:410] #5 _gmaps_content_point_field_save(stdClass Object ([nid] => 1856,[vid] => 10150,[uid] => 1,[created] => 1264936164,[type] => test,[language] => ,[changed] => 1264938137,[title] => Test,[teaser_js] => ,[teaser_include] => 1,[body] => ,[format] => 1,[revision] => 0,[name] => admin,[date] => 2010-01-31 12:09:24 +0100,[status] => 1,[promote] => 1,[sticky] => 0,[op] => Save,[submit] => Save,[preview] => Preview,[delete] => Delete,[form_build_id] => form-de1a152fd2628c5216994bc1e1642dda,[form_token] => 69a26395baf8c7894122c909eee83582,[form_id] => test_node_form,[field_lonlat] => Array ([0] => Array ([value] => stdClass Object ([point] => stdClass Object ([search] => Array ([query] => 06179 Teutschenthal, Germany,[domain] => de),[latitude] => 51.45274,[longitude] => 11.810997,[elevation] => 0,[map_type] => earth,[z] => 4965087.563669,[y] => 815207.3932104,[x] => 3898439.594363,[vid] => 10150,[nid] => 1856,[field_name] => field_lonlat,[delta] => 0)))),[comment] => 2,[menu] => Array ([mlid] => 0,[module] => menu,[hidden] => 0,[has_children] => 0,[customized] => 0,[options] => Array (),[expanded] => 0,[parent_depth_limit] => 8,[link_title] => ,[parent] => primary-links:0,[weight] => 0,[plid] => 0,[menu_name] => primary-links),[path] => content/test-0,[pid] => 756,[pathauto_perform_alias] => 1,[old_alias] => content/test-0,[hs_form_build_id] => hs_form_3a3d0ae7c48772d40ec5cf73acaeb687,[teaser] => ,[validated] => 1,[is_new] => ,[timestamp] => 1264938137), Array ([field_name] => field_lonlat,[type_name] => test,[display_settings] => Array ([label] => Array ([format] => above,[exclude] => 0),[teaser] => Array ([format] => default,[exclude] => 0),[full] => Array ([format] => default,[exclude] => 0),[4] => Array ([format] => default,[exclude] => 0),[token] => Array ([format] => default,[exclude] => 0)),[widget_active] => 1,[type] => gmaps_point,[required] => 0,[multiple] => 0,[db_storage] => 1,[module] => gmaps_content,[active] => 1,[locked] => 0,[columns] => Array (),[gmaps] => Array ([input] => Array ([enable_geocoder] => 1,[use_map] => 1,[collapsible] => 1,[collapsed] => -1,[input_disabled] => 1),[meta] => Array ([search] => Array ([point_snippet] => 1,[refloc_snippet] => 1,[geoip_snippet] => 1),[meta] => Array ([geo_position] => 1,[icbm] => 1),[rss] => Array ([w3c] => 0,[simple] => 1,[gml] => 1),[link] => Array ([teaser] => Array ([content] => Array ([show] => all,[point] => plain),[distance] => Array ([show] => min,[refloc] => 1,[viewloc] => 0,[geoip] => 1)),[full] => Array ([content] => Array ([show] => all,[point] => plain),[distance] => Array ([show] => min,[refloc] => 1,[viewloc] => 0,[geoip] => 1)))),[formatter] => Array ([point] => Array ([user_settings] => 1,[format] => dd,[elevation] => 1,[dd_prec] => 6,[dms_prec] => 0,[cart_prec] => 2,[elevation_prec] => 0),[map] => Array ([map] => 5,[static_map] => 1,[cache] => 1,[cache_expires] => 0,[content] => default),[map_links] => Array ([google_find] => 0,[google_directions_from] => 0,[google_directions_to] => 0,[yahoo_find] => 0,[yahoo_directions_from] => 0,[yahoo_directions_to] => 0,[mapquest_find] => 0,[mapquest_directions_from] => ,[mapquest_directions_to] => )),[map_type] => earth,[enable_bounds] => 0,[enable_3D] => 0,[enable_pov] => 0,[enable_privacy] => 0),[widget] => Array ([gmaps] => Array ([input] => Array ([enable_geocoder] => 1,[use_map] => 1,[collapsible] => 1,[collapsed] => -1,[input_disabled] => 1),[meta] => Array ([search] => Array ([point_snippet] => 1,[refloc_snippet] => 1,[geoip_snippet] => 1),[meta] => Array ([geo_position] => 1,[icbm] => 1),[rss] => Array ([w3c] => 0,[simple] => 1,[gml] => 1),[link] => Array ([teaser] => Array ([content] => Array ([show] => all,[point] => plain),[distance] => Array ([show] => min,[refloc] => 1,[viewloc] => 0,[geoip] => 1)),[full] => Array ([content] => Array ([show] => all,[point] => plain),[distance] => Array ([show] => min,[refloc] => 1,[viewloc] => 0,[geoip] => 1)))),[formatter] => Array ([point] => Array ([user_settings] => 1,[format] => dd,[elevation] => 1,[dd_prec] => 6,[dms_prec] => 0,[cart_prec] => 2,[elevation_prec] => 0),[map] => Array ([map] => 5,[static_map] => 1,[cache] => 1,[cache_expires] => 0,[content] => default),[map_links] => Array ([google_find] => 0,[google_directions_from] => 0,[google_directions_to] => 0,[yahoo_find] => 0,[yahoo_directions_from] => 0,[yahoo_directions_to] => 0,[mapquest_find] => 0,[mapquest_directions_from] => ,[mapquest_directions_to] => )),[map_type] => earth,[enable_bounds] => 0,[enable_3D] => 0,[enable_pov] => 0,[enable_privacy] => 0),[default_value] => Array ([0] => Array ([value] => stdClass Object ([point] => stdClass Object ([search] => Array ([query] => ,[domain] => de),[latitude] => ,[longitude] => ,[elevation] => 0,[map_type] => earth)))),[default_value_php] => ,[label] => LonLat,[weight] => 31,[description] => ,[type] => gmaps_content_point,[module] => gmaps_content)), Array ([0] => Array ([value] => stdClass Object ([point] => stdClass Object ([search] => Array ([query] => 06179 Teutschenthal, Germany,[domain] => de),[latitude] => 51.45274,[longitude] => 11.810997,[elevation] => 0,[map_type] => earth,[z] => 4965087.563669,[y] => 815207.3932104,[x] => 3898439.594363,[vid] => 10150,[nid] => 1856,[field_name] => field_lonlat,[delta] => 0)))), 1) called at [/var/www/vhosts/MYSITE/httpdocs/sites/all/modules/gmaps/modules/gmaps_content/includes/gmaps_content.node-form.inc:329]
Comment #8
lyricnz commentedAny chance of getting that formatted properly? (newlines and whitespace) Use a file attachment if you have to.
But I don't think I'm going to be able to help you - just getting the right data for the module maintainer now.
Comment #9
thommyboy commentedfirst question for me is- if anyone can reproduce the problem?
Comment #10
vatavale commentedI have the ~same problem.
I create gmaps point field, with "Enable bounds" cheked and all is fine. But if after that uncheck "Enable bounds" in Map Type in field settings then on node save it is error:
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in ...\includes\database.mysqli.inc on line 323.Comment #11
xmarket commented