Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-11424

Quick-Mod Tools race condition results in NO_MODE

XMLWordPrintable

      Steps to reproduce this behavior:

      1. Moderator Alice views a topic.
      2. Alice elects from "Quick-mod tools" the "Move topic" options.
      3. Alice clicks "Submit".
      4. In the meanwhile moderator Bob has successfully deleted the topic.
      5. For Alice /includes/mcp/mcp_main.php is running check_ids() which doesn't find the topic (any IDs) anymore, hence the function just returns FALSE.
      6. The code enters switch ($mode) and since there is no mode, Alice gets a NO_MODE error message.

      However, this results in an unexpected error although we (the code) know(s) better.

      To cure this I did the following in that file:
      Find

      trigger_error('NO_MODE', E_USER_ERROR);

      Before, add:

      if( $quickmod ) {
      	switch( $action ) {
      		case 'lock':
      		case 'unlock':
      		case 'make_announce':
      		case 'make_sticky':
      		case 'make_global':
      		case 'make_normal':
      		case 'make_onindex':
      		case 'move':
      		case 'fork':
      		case 'delete_topic':
      			trigger_error( 'TOPIC_NOT_EXIST' );  // no E_USER_ERROR
      		break;
       
      		case 'lock_post':
      		case 'unlock_post':
      		case 'delete_post':
      			trigger_error( 'POST_NOT_EXIST' );  // no E_USER_ERROR
      		break;
      	}
      }

      This way moderator Alice does not have to encounter an error which looks like something of the board broke.

            nickvergessen Joas Schilling
            AmigoJack AmigoJack
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: