running Core version 6.26, tried to update to Location version 6.x-3.3

when running update.php, got this error:

  • warning: array_merge(): Argument #2 is not an array in /var/www/xxx/update.php on line 173.
  • warning: Invalid argument supplied for foreach() in /var/www/xxx/update.php on line 337.

i am not 100% sure, but i believe that what is missing is the line
$ret = array();
at the beginning of function location_update_6310 in location.install

Comments

earthangelconsulting’s picture

ps: forgive me if this is a duplicate, but the issues search isn't working properly right now, times out and gives whitescreen when searching for issues containing a particular text string. so i am unable to tell if this has been reported already or not.

ITMonkey’s picture

I get the same error when updating to this version, rather than installing.

warning: array_merge(): Argument #2 is not an array in .../update.php on line 173.
warning: Invalid argument supplied for foreach() in .../update.php on line 340.

jacqi.jordan’s picture

I am also experiencing these errors on a fresh install of Drupal 6.28 when updating the Location module from 6.x-3.2 to 6.x-3.3:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /xxx/xxx/Sites/xxx/update.php on line 173.

warning: Invalid argument supplied for foreach() in /xxx/jxxx/Sites/xxx/update.php on line 340.

This issue may be related, which I have also posted to: https://drupal.org/node/2148765

Only local images are allowed.

Tech-Tonic’s picture

Thanks @goatvirus I had the same problem with this update from 3.2 -> 3.3 and your fix sorted it, but it needed both the variable array declaration at the beginning and return at the end otherwise it won't show the result.

/**
 * Adds the Country code to name table "location_country".  It is created from the included array country array.
 */
function location_update_6310() {
    $ret = array();
  
    //Create the new table
    $schema = location_schema() ;
    db_create_table($ret, 'location_country', $schema['location_country']);

    //Fill it.
    $sql = 'INSERT INTO {location_country} (code, name) VALUES ';
    $sql2 = '';
    $countries = location_get_iso3166_list();
    foreach($countries as $code => $name){
        $variables = array();

        $variables[] = $code;
        $variables[] = $name;
        $sql2 = "('$code', '$name')";
        db_query($sql . $sql2);
    }

    return $ret;   
}

I also had a "table already exists" error so simply deleted the empty drupal_location_country table before running the update. Probably caused by a previous failed update to this module.

earthangelconsulting’s picture

@will-mowlam - thanks for posting that, all possible detail helps here.

FYI to all... I have had official word from module maintainer podarok that as far as GMap goes (and I am guessing this applies to Location too, which he also maintains) we are kind of "on our own" for any D6 versions:

6.x branch is not supported.
Only patches, posted and reviewed by users can be pushed to repo.
No feature requests. If You want to get in feature request for 6.x branch you should post it to 7.x and after that backport to 6.x for review.

Well then... let's just keep patching until we can patch no longer :-)

legolasbo’s picture

Status: Active » Closed (outdated)

Closing old D6 issues as D6 is end of life