Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12986

Wrong functions call order breaks detection of common words in search

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-RC3
    • Fix Version/s: 3.1.0-RC4
    • Component/s: Search
    • Labels:
      None

      Description

      In search.php

      	$common_words = $search->get_common_words();
       
      	// let the search module split up the keywords
      	if ($keywords)
      	{
      		$correct_query = $search->split_keywords($keywords, $search_terms);
      		if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id))
      		{
      			$ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : '';
      			$word_length = $search->get_word_length();
      			if ($word_length)
      			{
      				trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $word_length['min']), $user->lang('CHARACTERS', (int) $word_length['max'])));
      			}
      			else
      			{
      				trigger_error($ignored);
      			}
      		}
      	}
      
      

      $search->get_common_words() call goes before the split_keywords() call, but $search->common_words array is being generated within the function $search->split_keywords(). Thus, get_common_words() return an empty array instead of common words array.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bantu Andreas Fischer
                Reporter:
                rxu rxu
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: