Page 1 of 1

CGFeedback module error - Argument #2 is not an array in action.summary.php

Posted: Mon Aug 10, 2009 3:07 pm
by jk
Hi

I have been working with the CGFeedback module and all was going well.  Suddenly I am getting an error on the summary page which is as follows;

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/XX/public_html/modules/CGFeedback/action.summary.php on line 251


The function the error relates to is copied below and I have highlighted line 251 in red.  The feedback form still works and the summary page displays the comments properly - the only problem seems to be the error message itself.  I have not updated the CMS or module and I have not done anything to the database so I am confused as to how this error arose and what could fix it.


// get field definitions
$fields = '';
$sql = 'SELECT id,name,type FROM '.CGFEEDBACK_TABLE_FIELDDEFS.' ORDER BY iorder';
$tmp = $db->GetArray($sql);
if( is_array($tmp) )
  {
    $fields = $this->array_to_hash($tmp,'id');
  }

$dbr = $db->SelectLimit($query,$pagelimit,$startoffset,$qparms);
if( !$dbr )
  {
    echo "DEBUG SUMMARY QUERY: SQL FAILED";
    echo "QUERY: ".$db->sql.'';
    echo "MESSAGE: ".$db->ErrorMsg().'';
    echo "SQUERY: ".$query.''; print_r( $qparms );
    die();
  }

$parms = $params;
$parms['feedback_origpage'] = $returnid;
$data = array();
while( $dbr && ($row = $dbr->FetchRow()) )
  {
    $prettyurl = "feedback/detail/{$row['id']}/{$detailpage}/";
    $prettyurl .= munge_string_to_url(substr($row['title'],0,30));
    $parms['cid'] = $row['id'];
    $row['detail_url'] = $this->CreateURL($id,'detail',
  $detailpage,$parms,$inline,
  $prettyurl);

    $sql = 'SELECT * FROM '.CGFEEDBACK_TABLE_FIELDVALS.' WHERE comment_id = ?';
    $tmp = $db->GetArray($sql,array($row['id']));
    if( is_array($tmp) && is_array($fields) )
      {
for( $i = 0; $i array_to_hash($tmp,'name');
      }

    $tmp = $fields;
    $data[] = $row;
  }

Any ideas?

JK