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
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
Duplicate of #346988: [master] Argument #1 is not an array.
#3
Re-opening this request.
This is for 5.x-3.0:
#346988: [master] Argument #1 is not an array
I am using:
I have the same issue as described above. Two array errors on Edit:
-pinxi
#4
marked #411982: warning: array_merge() a duplicate of this issue
#5
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
<?phplocation_invoke_locationapi($settings, 'defaults');
?>
#6
$location is defined further down, I'm guessing it just needs to be moved up before location_invoke_locationapi(). Patch attached.
#7
bump.
same thing for 5.x-3.x-dev...
#8
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);
}
}
}
...