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

Wrong functions call order breaks detection of common words in search

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1.0-RC4
    • 3.1.0-RC3
    • Search
    • None

      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.

            bantu Andreas Fischer [X] (Inactive)
            rxu rxu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: