Error when viewing User Profile - [function.array-key-exists
Buffer2k - September 24, 2009 - 11:04
| Project: | ImageCache Profiles |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Not at all but on some User profiles the following error occurs
"warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/tpkskh/modules/imagecache_profiles/imagecache_profiles.module on line 41."

#1
Can you provide more information about conditions where you get this error?
#2
Only on Userprofile pages. I override userprofiles with panels 2. Using an older dev version (September, 4th) of imagecache profiles with the same functions works fine.
; $Id: imagecache_profiles.info,v 1.1.4.1 2008/12/19 18:05:14 v1nce Exp $name = Imagecache Profile Pictures
description = Utilizes imagecache presets for user profile pictures.
package = ImageCache
dependencies[] = imagecache
core = 6.x
; Information added by drupal.org packaging script on 2009-09-04
version = "6.x-1.x-dev"
core = "6.x"
project = "imagecache_profiles"
datestamp = "1252023272"
The attached Version is the named one which i downloaded in september. This dev version contains most of the new improvements. maybe you find some differences.
#3
The main change between this versions
<?php- if (arg(0) == 'user' && is_numeric(arg(1))) {
+ if (arg(0) == 'user' && is_numeric(arg(1)) && (arg(2) == NULL || arg(2) == 'edit')) {
?>
So avatars are processed if URL is like /user/{number} or /user/{number}/edit
What is your URLs that have trouble?
Another change in displaying avatars on comments preview, this is more strong check for comment render but suppose this is not your case.
#4
Sorry, line 41 is a change for comments:
<?php// If viewing a comment - line 40
- if ($account->cid) {
+ if (array_key_exists('cid', get_object_vars($account))) {
?>
$account should be an object but error your provide said that is not object, which is strange
What is your php version?
#5
Ah okay! Comments. I override userprofiles with panels. i think comments may occur the error because i am using content_profile and comments are displayed on profiles.
My PHP Version 5.2.11
http://www.blacksins.de
here is a Profile
http://www.blacksins.de/darkdream/75
At the moment i switched back to the attached dev version.
#6
@Buffer2k I have no ability to debug your case but I think this bug is related to some other module which pass USER not as object but array.
Please try this patch or this module (remove .txt extension)
#7
Hi all,
I have this error too,same things,panel whith comments on profile.
#8
@toth_O please, try #6
#9
Works for me.
I have changed the status to "fixed"
Don't know if it's good first time i do that.
Oh thanks you andypost.
#10
@toth_O are you tryed patch from #6 to make it work? If patch works for you you should set status to RTBC
#11
Commited
#12
Automatically closed -- issue fixed for 2 weeks with no activity.