-
Bug
-
Resolution: Fixed
-
3.0.x
-
None
-
PHP Environment:
Database:
Trying to open a PM folder which doesn't exist (i.e. http://www.phpbb.com/community/ucp.php?i=pm&folder=799) produces a PHP warning instead of a proper error message:
[phpBB Debug] PHP Notice: in file /includes/ucp/ucp_pm_viewfolder.php on line 496: Undefined offset: 799
Possible fix:
Index: includes/functions_privmsgs.php===================================================================--- includes/functions_privmsgs.php (revision 8566)+++ includes/functions_privmsgs.php (working copy)@@ -119,7 +119,25 @@ global $phpbb_root_path, $phpEx; $folder = array();+ // Make sure the default boxes are defined+ $available_folder = array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX); + // make sure the folder exists if a custom one is specified+ if ($folder_id && !in_array($folder_id, $available_folder))+ {+ $sql = 'SELECT folder_id+ FROM ' . PRIVMSGS_FOLDER_TABLE . '+ WHERE folder_id = ' . $folder_id;+ $result = $db->sql_query($sql);++ if (!($row = $db->sql_fetchrow($result)))+ {+ $db->sql_freeresult($result);+ trigger_error('UNKNOWN_FOLDER');+ }+ $db->sql_freeresult($result);+ }+ // Get folder information $sql = 'SELECT folder_id, COUNT(msg_id) as num_messages, SUM(pm_unread) as num_unread FROM ' . PRIVMSGS_TO_TABLE . "@@ -136,9 +154,6 @@ } $db->sql_freeresult($result); - // Make sure the default boxes are defined- $available_folder = array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX);- foreach ($available_folder as $default_folder) { if (!isset($num_messages[$default_folder]))
|