Getting the error "Fatal error: Unsupported operand types in content_profile.module on line 80".

function content_profile_menu_alter(&$items) {
  foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
    $item = &$items['user/%user_category/edit/'. $type];
    $item = array(
      'page callback' => 'content_profile_page_edit',
      'page arguments' => array($type, 1),
      'access callback' => 'content_profile_page_access',
      'access arguments' => array($type, 1),
      'file' => 'node.pages.inc',
      'file path' => drupal_get_path('module', 'node'),
    ) + $item; // <- line 80 here
  }
}

Are you sure that $item is an array?

CommentFileSizeAuthor
#18 content_profile-580086.patch1.49 KBalexpott

Comments

milos.kroulik’s picture

Just got this error during database update of other modules. Could it be some interference?

Updated modules were:

  • Embedded Media Field [emfield-6.x-1.13]
  • File Aliases [file_aliases-6.x-1.0]
  • Search Lucene API [luceneapi-6.x-2.0-beta3]
  • Nodewords [nodewords-6.x-1.3-beta4]
  • Phone (CCK) [phone-6.x-2.10]
paoloteo’s picture

confirming... same issue here.
Only module we have update in common is: Nodewords [nodewords-6.x-1.3-beta4]

jennycita’s picture

Same problem... my only updated module was:

XML sitemap [xmlsitemap-6.x-1.1]

I used drush to update, if that makes any difference.

Everything worked fine when I disabled content_profile and content_profile_registration, updated xmlsitemap, and then re-enabled content_profile and content_profile_registration.

lyricnz’s picture

Same problem here, no nodewords module in place. The code in question is:

function content_profile_menu_alter(&$items) {
  foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
    $item = &$items['user/%user_category/edit/'. $type];
    $item = array(
      'page callback' => 'content_profile_page_edit',
      'page arguments' => array($type, 1),
      'access callback' => 'content_profile_page_access',
      'access arguments' => array($type, 1),
      'file' => 'node.pages.inc',
      'file path' => drupal_get_path('module', 'node'),
    ) + $item;
  }
}

with the "+ $item" being line 80. Clearly $item is not an array at that time. You could suppress the error by checking for is_array() before attempting to add to $item.

lyricnz’s picture

Status: Active » Fixed

Looks like similar issue discussed (and fixed) in #362036: Fatal error: Unsupported operand types in content_profile.module.

Status: Fixed » Closed (fixed)

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

finex’s picture

Status: Closed (fixed) » Active

I've had this error updating "Alter profile page" module from 6.x-2.3 to 6.x-2.5.

I'm using drupal 6.14, content profile 6.x-1.0-beta4 and cck 6.x-2.6.

I've used drush for the update.

briandj62’s picture

Just issued drush update command. After updating skinr, I got the following error:

...
Project skinr was updated successfully. Installed version is now 6.x-1.3.
Backups were saved into the directory <path_to_website>/backup/modules/20100127154357.     [ok]
Cache cleared.
No database updates required                                                               [success]
PHP Fatal error:  Unsupported operand types in <path_to_website>/sites/all/modules/content_profile/content_profile.module on line 80

Fatal error: Unsupported operand types in <path_to_website>/sites/all/modules/content_profile/content_profile.module on line 80
Drush command could not be completed.                                                      [error]

I am using Drupal 6.15.
I have no idea whether there is any relation between the two modules.

butler360’s picture

I get this whenever I do any updates with drush.

briandj62’s picture

I also get this error whenever I update with drush:

PHP Fatal error:  Unsupported operand types in /var/www/html/drupal/sites/all/modules/content_profile/content_profile.module on line 80

And the worst is that now the Administer > User Management page (admin/user) is blank (although I can still navigate to the menu items below that page).

Any ideas/fixes?

lyricnz’s picture

Status: Active » Closed (duplicate)

briandj62: as explained in the issue linked in #5, this was fixed (in dev) in August, but there hasn't been a new release since then.

#362036: Fatal error: Unsupported operand types in content_profile.module

You'll either need to run the -dev version of Content Profile (in red on http://drupal.org/project/content_profile ), or apply this change manually.

butler360’s picture

I have the dev version installed and still get the error.

lyricnz’s picture

What *date* is your -dev version?

butler360’s picture

Sorry, by dev version I meant the latest (Jan 13).

sandy121’s picture

Title: Fatal error: Unsupported operand types in content_profile.module on line 80 » Fatal error: Unsupported operand types in content_profile.module on line 430

Unsupported operand types in content_profile.module on line 430

function content_profile_get_settings($type, $return = 'all') {
$settings = variable_get('content_profile_'. $type, array());
$settings += content_profile_settings_info(); ////////// line 430
if ($return == 'all') {
return $settings;
}
return $settings[$return];
}

alberto56’s picture

Title: Fatal error: Unsupported operand types in content_profile.module on line 430 » Fatal error: Unsupported operand types in content_profile.module on line 430 and line 80

Same here, this error occurs only with drush updates of non-related modules. Perhaps adding some type checking might do the trick.

alberto56’s picture

Actually, this problem prevents dabatase updates using drush. On sites with this version of of content profile, I use this drush code to update by database and it works:

drush disable content_profile
drush updatedb -y
drush enable content_profile
alexpott’s picture

StatusFileSize
new1.49 KB

I get the line 80 error whilst updating other modules using drush. It is occurring because $items['user/%user_category/edit/'. $type] is not an array yet.

I am using the dev version of content_profile as of 2010-Mar-26.

I thought this might be because the user module has not created the menu items as a result of the call to content_profile_user do get the categories. I noticed that the weight of the content_profile module is -1 and the weight of the user module is 0 so I tried changing the weight of content_profile to 1 to see if this would fix it. It did not.

So the only fix I can think of is to check if $item is an array before doing the operation... patch attached... it eliminates the error when upgrading a module / your site using drush.

alberto56’s picture

Status: Closed (duplicate) » Active

#18 seems to suggest that this error is not, in fact, a duplicate (the error occurring even with the recent dev version). I haven't had a chance to test the patch but I will nonetheless set back to active.

fago’s picture

Status: Active » Fixed

ok. This shouldn't happen as content profile alters $items, so I guess there is an underlying bug somewhere. Anyway, I commited a check to prevent to throw errors in that case.

Status: Fixed » Closed (fixed)

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