Hi,

I have a problem.
I modified the location\supported\location.it in order to pick in the autocomplete forms the city names instead of province names.
a sample of the new file is below:

<?php
// $Id: location.it.inc,v 1.7 2008/02/04 02:05:32 bdragon Exp $

// Italy

function location_province_list_it() {
  return array(
'Agli' => "Agli",
'Airasca' => "Airasca",
'Ala di Stura' => "Ala di Stura",
'Albiano dIvrea' => "Albiano dIvrea",
'Alice Superiore' => "Alice Superiore",
'Almese' => "Almese",
'Alpette' => "Alpette",
'Alpignano' => "Alpignano",
'Andezeno' => "Andezeno",
'Andrate' => "Andrate",
'Angrogna' => "Angrogna",
....
  );
}

the autocomplete functionality is working after this modification.
But when I create a new node I get the following error message and the node is not displayed on the map (0-0 coordinates).

preg_match() expects parameter 2 to be string, array given in C:\...\includes\bootstrap.inc on line 679.

Please can someone put me in the right direction?

Thanks

CommentFileSizeAuthor
#3 location.token_.inc_.patch853 bytesolav

Comments

robomalo’s picture

This happens to me in sites I work on in Drupal 5 and 6, both because of the location module. It is because of a function in bootstrap.inc that expects $text to be a string. In my cases it's because the lat and long are floats rather than strings.

EgonO’s picture

Version: 5.x-3.0-test3 » 5.x-3.0-rc1
Component: Miscellaneous » Code
Category: task » bug
Priority: Normal » Critical

+1 subscribing. same here with drupal 5.11 and location 5.x-3.0-rc1

olav’s picture

Version: 5.x-3.0-rc1 » 6.x-3.0-rc1
Status: Active » Needs review
StatusFileSize
new853 bytes

For me, the error occurs in Drupal 6.5 and location-6.x-3.0-rc1.tar.gz when I save a node with location information. Backtracing the error in bootstrap.inc leads to line 18 in location.token.inc

In my case, $object->location is

array
  0 => 
    array
      'lid' => string '3' (length=1)
      'name' => string 'Altes Rathaus, Bonn' (length=19)
      'street' => string 'Marktplatz 1' (length=12)
      'additional' => string '' (length=0)
      'city' => string 'Bonn' (length=4)
      'province' => string 'NW' (length=2)
      'postal_code' => string '53111' (length=5)
      'country' => string 'de' (length=2)
      'latitude' => string '50.735041' (length=9)
      'longitude' => string '7.102927' (length=8)
      'source' => int 1
      'is_primary' => string '0' (length=1)
      'locpick' => 
        array
          'user_latitude' => string '50.735041' (length=9)
          'user_longitude' => string '7.102927' (length=8)

The problem is that locpick is an array which check_plain() does not handle. The attached patch check for an array and loops over the array fields.

carlogen’s picture

Hi Olav,

I checked your patch.

In my case, it fix the error, but the token does not work anymore.
I am using an autonode title with token [location-province_name_N], and it does not give back the province name.

I checked [location-province_N] and it works.

bdragon’s picture