Argument #1 is not an array... location.module on line 1409.

frankcarey - February 23, 2009 - 21:29
Project:Location
Version:6.x-3.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /media/wd500/www/devroots/d6-matadortravel-com/sites/all/modules/location/location.module on line 1409.

Error appears twice when viewing a user's page, with content profile, APK installed on drupal 6.9

This is the referenced code...

<?php
**
*
Returns an empty location object based on the given settings.
*/
function
location_empty_location($settings) {
 
$defaults = location_invoke_locationapi($location, 'defaults');
  if (isset(
$settings['form']['fields'])) {
    foreach (
$settings['form']['fields'] as $k => $v) {
     
$defaults[$k] = array_merge($defaults[$k], $v); //line 1409
   
}
  }

...
?>

So it looks like location_invoke_locationapi is screwing up, giving a non array (or nothing at all)...

#1

tansel - February 25, 2009 - 21:49

Same problem

warning: array_merge() [function.array-merge]: Argument #1 is not an array in xxx/sites/all/modules/location/location.module on line 1409.
warning: array_merge() [function.array-merge]: Argument #1 is not an array in xxx/sites/all/modules/location/location.module on line 1409.

#2

bdragon - March 3, 2009 - 22:23
Status:active» duplicate

Duplicate of #346988: [master] Argument #1 is not an array.

#3

pinxi - April 3, 2009 - 02:52
Status:duplicate» active

Re-opening this request.

This is for 5.x-3.0:
#346988: [master] Argument #1 is not an array

I am using:

version = "6.x-3.0"
core = "6.x"
project = "location"
datestamp = "1229117725"

I have the same issue as described above. Two array errors on Edit:

* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /drupal-6.10/sites/all/modules/location/location.module on line 1409.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /drupal-6.10/sites/all/modules/location/location.module on line 1409.

-pinxi

#4

YesCT - April 17, 2009 - 12:10

marked #411982: warning: array_merge() a duplicate of this issue

#5

KarenS - July 4, 2009 - 18:02
Priority:normal» critical

See:

<?php
**
*
Returns an empty location object based on the given settings.
*/
function
location_empty_location($settings) {
 
$defaults = location_invoke_locationapi($location, 'defaults');
  if (isset(
$settings['form']['fields'])) {
    foreach (
$settings['form']['fields'] as $k => $v) {
     
$defaults[$k] = array_merge($defaults[$k], $v); //line 1409
   
}
  }

...
?>

Note that $location (which is never defined) is used in location_invoke_location(). I don't know if that was supposed to be

<?php
location_invoke_locationapi
($settings, 'defaults');
?>
or something else.

#6

KarenS - July 4, 2009 - 18:23
Status:active» needs review

$location is defined further down, I'm guessing it just needs to be moved up before location_invoke_locationapi(). Patch attached.

AttachmentSize
location_381498.patch 952 bytes

#7

jeffschuler - October 5, 2009 - 22:11

bump.

same thing for 5.x-3.x-dev...

AttachmentSize
location_381498_d5.patch 922 bytes

#8

bricef - December 4, 2009 - 08:44

I had the same problem due to a malformed settings. I corrected the problem like this :

function location_empty_location($settings) {
  $location = array();
  $defaults = location_invoke_locationapi($location, 'defaults');
  if (isset($settings['form']['fields'])) {
    foreach ($settings['form']['fields'] as $k => $v) {
    if (! is_null ($defaults[$k])){
    $defaults[$k] = array_merge($defaults[$k], $v);
    }
    }
  }
...

 
 

Drupal is a registered trademark of Dries Buytaert.