if nothing to load, 'load' warns no array

sime - November 19, 2007 - 05:45
Project:cck_map
Version:5.x-3.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

'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));
        }
      }
?>

#1

beeradb - November 20, 2007 - 02:28
Status:active» closed

i've merged this into the latest version.

Thanks,
Brad

#2

Summit - December 27, 2007 - 20:44
Version:5.x-3.1-1» 5.x-3.2-1
Status:closed» 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

Summit - December 27, 2007 - 20:53
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

ahoria - April 16, 2008 - 20:49
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

Doha-Info.com - May 21, 2008 - 08:48

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

renata - June 10, 2008 - 13:06

subscribing

 
 

Drupal is a registered trademark of Dries Buytaert.