Download & Extend

if nothing to load, 'load' warns no array

Project:cck_map
Version:5.x-3.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

'load' op of cck_map_field gives a warning if there is no data to load. Here's how I suppressed it, but just a suggestion of course.

<?php
   
case 'load':
      if (
$node->nid) {
       
$map_info = db_fetch_array(db_query("SELECT maplat, maplon, mapzoom, maptype from {cck_map} WHERE nid = %d and vid = %d", $node->nid, $node->vid));
        if (
is_array($map_info)) {
          return array(
$field['field_name'] => array_merge($node->$field['field_name'], $map_info));
        }
      }
?>

Comments

#1

Status:active» closed (fixed)

i've merged this into the latest version.

Thanks,
Brad

#2

Version:5.x-3.1-1» 5.x-3.2-1
Status:closed (fixed)» active

Hi,

It looks like this error is still there, or another error arose because of this patch?
May be I am wrong off course..my bugissue here: http://drupal.org/node/204264 I think they are related because the line of change is the same..line 264..

thanks in advance for your reply,

greetings,
Martijn

#3

Status:active» needs review

Hi,

I altered the code as follows (I made an array of the first argument):
line 264: return array($field['field_name'] => array_merge(array($node->$field['field_name']), $map_info));

I am not getting the warning anymore, is this a correct change?

greetings,
Martijn

#4

Version:5.x-3.2-1» 5.x-3.3

Hi,

I am still getting this error in version 3.3. Any updates on this fix?

Thanks.

#5

Getting this error as well. CCK Map field set to optional, but if no marker placed it returns error:
warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/dohainfo/public_html/sites/all/modules/cck_map/cck_map.module on line 260.

#6

subscribing