Download & Extend

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

Project:Content Profile
Version:6.x-1.0-beta4
Component:Base module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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?

Comments

#1

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]

#2

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

#3

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.

#4

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

<?php
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.

#5

Status:active» fixed

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

#6

Status:fixed» closed (fixed)

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

#7

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.

#8

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.

#9

I get this whenever I do any updates with drush.

#10

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?

#11

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.

#12

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

#13

What *date* is your -dev version?

#14

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

#15

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];
}

#16

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.

#17

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

#18

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.

AttachmentSize
content_profile-580086.patch 1.49 KB

#19

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.

#20

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.

#21

Status:fixed» closed (fixed)

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

nobody click here