Warning after install

dlivingstone - May 23, 2009 - 19:57
Project:Instant messenger
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Running latest dev version for on D 6.10, but I get the following error after enabling the module:

warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in mysite.com/sites/all/modules/im/im.module on line 551.

Thanks in advance for all help. Looking forward to using the module.

#1

pahariwalla - May 23, 2009 - 21:27

So ... the only way i was able to recreate this error by

  1. made a custom module that hooked into hook_im_friends (e.g. mymodule.module with a function mymodule_im_friends()
  2. returned something other than an array of ints. for example, return array(1,3,7,2,8,11);

Any change you are doing something like that? Or maybe you have another module that also has an identically named hook. hmm I wonder how i should deal with that. (other than of course providing some documentation around using this hook) I do need to update the project page, my bad, I'll try to get that done asap.

Another confusing thing is that under admin/settings/im i have a select box to select "all users" or a view or a user relationship. these actually get ignored if you hook into hook_im_friends. i think that one solution would be to add any module implenetations of the hook to to the select choices. However, this would prevent multiple modules from adding to the list of friends.

Gotta think about this one, and i'd appreciate any feedabck on how it should behave - but in the mean time, i'll at least put in some docs and also some error trapping if you've implemented the hook and are returning bad data.

You can check to swee if any other module implements hook_im_friend by using grep, e.g. in the shell command line, go to sites/all/modules and type in

grep -i -n -R "_im_friends(" *

You should see im.module listed, and that's all. if you see another module listed, then that is probably the problem.

I'll try to get some error trapping and docs in this weekend.

Please let me know what you find. Thanks

#2

pahariwalla - May 24, 2009 - 00:36

Fixed and commited. My real bad here. After introducing hook_im_friends I failed to test User Relationships, and Views ... do'h. This should fix the problem. I also added some error checking ...

Tarball should be updated tomorrow =- look for a date > 2009-May-19

Meanwhile you could download the module file (not the whole directory) from http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/im/im.modul...

Just replace the file "im.module" in your modules/im folder

#3

pahariwalla - May 24, 2009 - 16:02
Status:active» closed

#4

dlivingstone - May 24, 2009 - 17:15
Status:closed» active

I replaced the file with this latest code. The module seems to be functioning well otherwise, but I now get this error:

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in mysite.com/sites/all/modules/im/im.module on line 525.

Thanks again

#5

pahariwalla - May 24, 2009 - 17:55

Yeah ... do'h.... I'm trying to do too much stuff in a hurry (I'm gearing up for a trip to chicago and then india ... trying to meet deadlines, yada yada ... )

I just fixed that error (an hour ago .. ) but the module should work as long as there is at least 1 other user online... if you want the fixed version, the tarball probably won't get created until tommorrow, but you can download the latest from http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/im/im.modul...

thanks for hanging in there...

#6

dlivingstone - May 25, 2009 - 03:35

Excellent. Thanks so much for the speedy responses, and funky module. Have a great trip!

#7

pahariwalla - May 25, 2009 - 04:37

Most welcome and thanks. BTW After you've got it up and running on your site, I'd love any info on how it's working out...

#8

pahariwalla - May 25, 2009 - 07:12
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.