1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed User Mentions sometimes generate errors

Discussion in 'Resolved Bug Reports' started by Xon, Aug 26, 2015.

  1. Xon

    Xon Well-Known Member

    If a post has a valid user mention, and then a user mention which is too long, the tagging dies.

    This is because of the length test in XenForo_Model_UserTagging::_getTagMatchUsers:
    Code:
    		foreach ($matches AS $key => $match)
    		{
    			if (utf8_strlen($match[1][0]) > 50)
    			{
    				// longer than max username length
    				continue;
    			}
    ...
    		}
    ...
    			foreach ($matchKeys AS $key)
    			{
    				if ($user["match_$key"])
    				{
    					$usersByMatch[$key][$user['user_id']] = $userInfo;
    				}
    			}
    
    The line "if ($user["match_$key"])" is at fault, as that key will never exist because it's generator was skipped.

    This needs to be wrapped in an !empty() or isset() && $value guard.
     
  2. Mike

    Mike XenForo Developer Staff Member

    We had this reported once before, but didn't have the reproduce case so didn't manage to trigger it. But no problem reproducing it here with the explanation. Fixed now, thanks. :)
     
    tufan and Xon like this.

Share This Page