Hi there,

I am getting the following warning after installing the linkedin module:

"Warning: Invalid argument supplied for foreach() in _block_rehash()" (apache2, php5.3)

According to this post, it is related to a wrong hook_block_info() implementation (see post #10 on the same page).

Sylvain

CommentFileSizeAuthor
#6 i1371500-6.patch644 bytesattiks

Comments

stevenjohn’s picture

I have the same issue, added details to the block page, hope they release a working patch soon

socialnicheguru’s picture

linkedin_auth, linkedin_profile are the two modules

pasqualle’s picture

Yes, hook_block_info() must always return an array.
wrong:

function linkedin_profile_block_info() {
  if (variable_get('linkedin_profile_user_page_enabled', 0) == 3) {
    $blocks['linkedin_profile'] = array(
      'info' => t('LinkedIn Profile'),
      'description' => t('User\'s LinkedIn profile'),
    );
    return $blocks;
  }
}

good:

function linkedin_profile_block_info() {
  $blocks = array();
  if (variable_get('linkedin_profile_user_page_enabled', 0) == 3) {
    $blocks['linkedin_profile'] = array(
      'info' => t('LinkedIn Profile'),
      'description' => t('User\'s LinkedIn profile'),
    );
  }
  return $blocks;
}
Nigeria’s picture

Solved my problem when I added it to the profile module.

wallbay1’s picture

Hello where do i put the changes?
which folder? which file ?

thanks

attiks’s picture

Status: Active » Needs review
StatusFileSize
new644 bytes

One is already fixed in the dev version, patch included for other one

socialnicheguru’s picture

will this be included also. as of march dev version this patch is not

attiks’s picture

@SocialNicheGuru first thing that has to be done is test this and if it's working mark it as RTBC.

socialnicheguru’s picture

sorry... it works!

attiks’s picture

Status: Needs review » Reviewed & tested by the community

changing status according to 9

xurizaemon’s picture

Title: warning block_rehash() » hook_block_info() must return an array() - warns "Invalid argument supplied for foreach() in _block_rehash()"
Component: LinkedIn API » Code
Issue tags: -warning

RTBC indeed. Warning shows on admin/structure/block etc.

ZenDoodles’s picture

xurizaemon’s picture

Yeah agreed, #1703360: Unnecessary Variable for blocks looks like a better fix than this.

davad’s picture

Status: Reviewed & tested by the community » Closed (duplicate)