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

andypost - September 24, 2009 - 18:09

Can you provide more information about conditions where you get this error?

#2

Buffer2k - September 25, 2009 - 09:22

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.

AttachmentSize
imagecache_profiles.zip 11.2 KB

#3

andypost - September 25, 2009 - 09:58

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

andypost - September 25, 2009 - 10:04

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

Buffer2k - September 25, 2009 - 17:17

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

andypost - September 25, 2009 - 18:21

@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)

AttachmentSize
586546_icp.patch 837 bytes
imagecache_profiles.module 7.1 KB

#7

toth_O - October 9, 2009 - 22:39

Hi all,
I have this error too,same things,panel whith comments on profile.

#8

andypost - October 11, 2009 - 07:48

@toth_O please, try #6

#9

toth_O - October 20, 2009 - 22:16
Status:active» fixed

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

andypost - October 20, 2009 - 22:23
Status:fixed» reviewed & tested by the community

@toth_O are you tryed patch from #6 to make it work? If patch works for you you should set status to RTBC

#11

andypost - October 28, 2009 - 07:46
Status:reviewed & tested by the community» fixed

Commited

#12

System Message - November 11, 2009 - 07:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.