Needs work
Project:
Drupal for Facebook
Version:
6.x-3.x-dev
Component:
Facebook Connect
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Sep 2009 at 13:17 UTC
Updated:
22 Feb 2011 at 00:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
nancydruI don't see a "foreach" anywhere near line 305.
Comment #2
nadams84 commentedI'm getting the same problem but on line 325 'using latest dev version on 27/03/10 or 03/27/10', its the "foreach" statement within the;
function realname_theme_registry_alter......etc....
block of code.
Help appreciated, any ideas??
Comment #3
whan commentedI'm getting the same error.
Comment #4
Juan C commentedSame warning appear upon updating fb (drupal for facebook):
Invalid argument supplied for foreach() in sites/all/modules/realname/realname.module on line 325
Comment #5
whan commentedComment #6
mstiHi!
I get the same error.
What info should I provide you with?
Comment #7
nancydruTry this patch. I'm not sure that fb is correct, but this will get around it.
Comment #8
mstiThe error was random so I canot be certain, but looks like the patch is working.
Thanks!!
Comment #9
nancydruCan someone else RTBC this?
Comment #10
gappleIt sounds like FB may be removing the array element, my guess is so that it can pull in its own images to override core's.
To be strict, the
ifstatement will throw an undefined index error instead of the invalid argument in the foreach; usingempty()to check the variable should remedy that.The patch really doesn't change any functionality, so I don't see any issues. My only thought is that the code could potentially be cleaned up, optimizing or removing the
foreach.The first patch retains the foreach, but uses
array_keys()to find only those keys that match the desired value in order to loop through. Potentially an unneeded optimization if there are few preprocess functions defined (as I assume is the case).The second patch does away with the foreach completely under the assumption that 'template_preprocess_user_picture' will only exist in the array once.
Comment #11
brisath commentedSubscribing. Same problem.
Comment #12
Cynthia Ewer commentedSubscribing.
Comment #13
dave reidfb_connect.module should not be removing them, it should be setting $theme_registry['user_picture']['preprocess functions'] = array() rather than leaving a NULL value.
Comment #14
Dave Cohen commentedI don't think that's the real problem. I think the correct fix is to weight username.module lighter than fb_connect.module so that it's hook_theme_registry_alter runs first. Otherwise it is adding a preprocess function to the wrong theme function.
Comment #15
aaron.r.carlton commentedsubscribing. i changed the module weight for user to -3, lighter than fb at -2 and cleared my cache, but still got the error.
Comment #16
Dave Cohen commentedIts the realname module that has to be lighter.
Comment #17
geosmaga commentedworking for me :-) realname must be lighter then fb (all fb modules enabled) and the issue is gone. Thanks
Comment #18
vkareh commentedI made a quick patch for those that need to update the weight of the RealName module.
This fixes the issue with the FB module, but it may also allows RealName to play nicer with other modules that override the theme registry, so feel free to move to the RealName queue if it's marked RTBC.
I used realname-6.x-1.x-dev (2010-Dec-10) and fb-6.x-3.0-rc7
Comment #19
socialnicheguru commentedjust adding realname tag. should the maintainer of that module be made aware of this?
Comment #20
nancydruShe is. This patch is inappropriate for the FB issue queue.
Comment #21
dave reidSorry but I'm going to have to push back on fb_connect.module for this. Use Devel module and then go to devel/theme/registry - every *single* theme hook has at least 'preprocess functions' => array('theme_preprocess') - it's very much wrong to remove this.
Even _theme_process_registry() has this:
which gets run before the alter hook in _theme_build_registry()
So in summary, it is wrong to do the following in fb_connect.module without also providing the 'default' values expected of a theme registry item:
Comment #22
dave reidAlthough definitely realname is doing a separate issue wrong by adding it's preprocess hook via theme_registry_alter() rather than just declaring its function as 'realname_preprocess_user_picture' so that it *automatically* gets called - no alter necessary.
Comment #23
dave reidFiled #1068666: No need to use hook_theme_registry_alter() to override template_preprocess_user_picture() with Realname, but this is still a "best practice" fix for Drupal for Facebook.
Comment #24
Dave Cohen commentedI'm willing to make a change, but what are these "'default' values expected of a theme registry item"?