Helo,

when trying to add new project i got error "Fatal error: Unsupported operand types in /home/unitedbytes/d7.unitedbytes.pl/sites/all/modules/support/support_pm/support_pm.admin.inc on line 544"

It seems that it happens only when i don't have any support clients.

Tracking down error leads to support_pm.admin.inc

 $clients = array(
    0 => t('-- All clients --'),
  ) + _support_clients_load();

the "+" operator works on array so it seems that _support_clients_load() does not return array.

in function _support_clients_load() we can clearly see that if there are no records from DB $clients is never defined. To fix this bug we only need $clients = array() at begining of function.

Fixed function below

function _support_clients_load($path = FALSE) {
  $clients = array();
  $result = db_query('SELECT clid, path, name FROM {support_client} WHERE status = :status ORDER BY name', array(':status' => 1));  
  foreach ($result as $client) {
    if ($path) {
      $clients[$client->clid] = check_plain($client->path);
    }
    else {
      $clients[$client->clid] = check_plain($client->name);
    }
  }
  drupal_alter('support_clients_load', $clients);
  return $clients;
}

Comments

vallab444’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2

hit by the same problem

bdragon’s picture

Status: Active » Fixed

Agreed.
There was an additional change needed -- support_timer was doing an isset check instead of an empty check. I also removed an is_array() check that wasn't strictly needed in the first place.

Thanks.

http://drupalcode.org/project/support.git/commit/d1e27a80faae1df841860c6...
http://drupalcode.org/project/support_timer.git/commit/9e88ab71b0034db58...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.