installed and configured chatroom. it seems to work just fine, but error messages appears in my php-error log on the server. the error message appears as soon as i enter a chatroom and continues until i leave the chatroom.

a new error line is posted at the same frequency as the setting for "Chat room update frequency, in seconds". if i change this setting, the frequency of the error changes, so they are connected, eh?

[25-Nov-2006 08:36:07] PHP Notice: Undefined index: type in .../modules/chatroom/chatroomread.php on line 124

line 124 in chatroomread.php is:

  $type      = is_null($_POST['type']) ? "msg" : $_POST['type'];

here is a snippet from mysql log. every time this query runs, an error is written to the php-error log.

061125  9:06:28	  63388 Connect     master@localhost on 
		  63388 Init DB     mydatabase
		  63388 Query       SELECT sid FROM sessions WHERE sid = 'cfxxxxxxxxxxx'
		  63388 Query       SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = 'cfxxxxxxxxxxx'
		  63388 Query       SELECT r.rid, r.name FROM role r INNER JOIN users_roles ur ON ur.rid = r.rid WHERE ur.uid = 2
		  63388 Query       SELECT coid FROM chatroom_online_list WHERE ccid = 1 AND session_id = 'cfxxxxxxxxxxx'
		  63388 Query       UPDATE chatroom_online_list
             SET modified = 1164474388
             WHERE ccid = 1
             AND uid = 2
             AND session_id = 'cfxxxxxxxxxxx'
		  63388 Query       SELECT     cr.old_msg_count
                      FROM       chatroom AS cr
                      INNER JOIN chatroom_chat AS cc
                      ON         cc.crid = cr.crid
                      WHERE      cc.ccid = 1
		  63388 Query       SELECT     cm.*,
                                 du.name,
                                 col.guest_id
                      FROM       chatroom_msg AS cm
                      INNER JOIN chatroom_online_list AS col
                      ON         col.session_id = cm.session_id AND col.ccid = cm.ccid
                      LEFT JOIN  users AS du
                      ON         du.uid = cm.uid
                      WHERE      cm.ccid = 1
                      AND        cm.cmid > 0
                      AND        (cm.recipient = '' OR cm.recipient = 'cfxxxxxxxxxxx' OR cm.session_id = 'cfxxxxxxxxxxx')
                      ORDER BY cm.cmid DESC LIMIT 20
		  63388 Query       SELECT     col.uid,
                                 col.session_id,
                                 col.guest_id,
                                 col.away,
                                 cc.chatname,
                                 du.name
                      FROM       chatroom_online_list AS col
                      INNER JOIN chatroom_chat AS cc
                      ON         cc.ccid = col.ccid
                      LEFT JOIN  users AS du
                      ON         du.uid = col.uid
                      WHERE      col.ccid = 1
                      AND        col.modified > (1164474388 - 5)
		  63388 Query       SELECT sid FROM sessions WHERE sid = 'cfxxxxxxxxxxx'
		  63388 Query       UPDATE sessions SET uid = 2, cache = 0, hostname = '192.168.1.205', session = 'node_overview_filter|a:0:{}watchdog_overview_filter|s:3:\"all\";', timestamp = 1164474388 WHERE sid = 'cfxxxxxxxxxxx'
		  63388 Query       UPDATE users SET access = 1164474388 WHERE uid = 2
		  63388 Quit       

the chatroom seems to otherwise work correctly. i do not see any errors in watchdog.

this issue http://drupal.org/node/99398 might be related?

my install:
drupal 4.7.4
php4-4.4.4_1
freebsd 5.4
apache-1.3.37_1
mysql-server-4.0.27

Comments

jillelaine’s picture

Assigned: Unassigned » jillelaine
Status: Active » Needs review

i'm not a php coder, but, after reading this thread http://drupal.org/node/99398 with this advice: "change

chatroomread.php [xxx] changed is_null($_POST['type']) to empty($_POST['type'])

"

i thought i'd try to fix the code. i searched chatroomread.php for instances of is_null vs empty and discovered offending line 124 was the only one with is_null. i changed it to empty and, poof, the error message is now gone.
line 124 now reads:

$type      = empty($_POST['type']) ? "msg" : $_POST['type'];

please review! thank you

darren oh’s picture

Status: Needs review » Fixed

Thanks! Fixed in CVS commit 46362.

Anonymous’s picture

Status: Fixed » Closed (fixed)