Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: gecitli on November 27, 2019, 04:00:23 AM

Title: Search error in 2.1 RC2 GitHub Version
Post by: gecitli on November 27, 2019, 04:00:23 AM
All,

Just got these errors form searching, see attachment.

This is only my test site.

Quoteroot
Today at 08:40 AM
::1
21df2fd2ce1a15c953236c76c59e42e7
Type of error: Undefined
8: Undefined variable: approve_query
http://localhost/son/index.php?action=search2
D:/xampp/htdocs/son/Sources/Search.php (Line 1715)


Title: Re: Search error in 2.1 RC2 GitHub GitHub Version
Post by: Arantor on November 27, 2019, 04:07:21 AM
What commit on GitHub?
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: gecitli on November 27, 2019, 04:13:13 AM
https://github.com/SimpleMachines/SMF2.1
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: Arantor on November 27, 2019, 05:01:01 AM
Yes, but when did you download it? It matters.
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: gecitli on November 27, 2019, 05:03:44 AM
today 2 hours ago.
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 27, 2019, 05:15:52 AM
Did you install the "release" download from Github or did you install from the git HEAD files?
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 27, 2019, 05:17:09 AM
Oh wait... This is the current HEAD I think, I saw those too in my installations. They only happen sporadically, once after update and once or twice during mod install/uninstall. (Edit: And for every forum search, quite expectedly.)
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 27, 2019, 05:23:06 AM
Yup, seeing this line and line 1828. (GH version of ~2019-10-10.)
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: gecitli on November 27, 2019, 05:24:24 AM
Quote from: m4z on November 27, 2019, 05:15:52 AM
Did you install the "release" download from Github or did you install from the git HEAD files?

I downloaded the "release" file from Github
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 27, 2019, 05:27:52 AM
Ah, because that file is actually the same as the rc2 in the download section here on sm.org, from way back (2019-03-30 or so).
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: gecitli on November 27, 2019, 05:34:09 AM
Quote from: m4z on November 27, 2019, 05:27:52 AM
Ah, because that file is actually the same as the rc2 in the download section here on sm.org, from way back (2019-03-30 or so).

No, not the same

// *** Retrieve the results to be shown on the page
$participants = array();
$request = $smcFunc['db_search_query']('', '
SELECT ' . (empty($search_params['topic']) ? 'lsr.id_topic' : $search_params['topic'] . ' AS id_topic') . ', lsr.id_msg, lsr.relevance, lsr.num_matches
FROM {db_prefix}log_search_results AS lsr' . ($search_params['sort'] == 'num_replies' ? '
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = lsr.id_topic)' : '') . '
WHERE lsr.id_search = {int:id_search}
ORDER BY {raw:sort} {raw:sort_dir}
LIMIT {int:start}, {int:max}',
array(
'id_search' => $_SESSION['search_cache']['id_search'],
'sort' => $search_params['sort'],
'sort_dir' => $search_params['sort_dir'],
'start' => $_REQUEST['start'],
'max' => $modSettings['search_results_per_page'],
)
);


// *** Retrieve the results to be shown on the page
$participants = array();
$request = $smcFunc['db_search_query']('', '
SELECT ' . (empty($search_params['topic']) ? 'lsr.id_topic' : $search_params['topic'] . ' AS id_topic') . ', lsr.id_msg, lsr.relevance, lsr.num_matches
FROM {db_prefix}log_search_results AS lsr' . ($search_params['sort'] == 'num_replies' || !empty($approve_query) ? '
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = lsr.id_topic)' : '') . '
WHERE lsr.id_search = {int:id_search}' . $approve_query . '
ORDER BY {raw:sort} {raw:sort_dir}
LIMIT {int:start}, {int:max}',
array(
'id_search' => $_SESSION['search_cache']['id_search'],
'sort' => $search_params['sort'],
'sort_dir' => $search_params['sort_dir'],
'start' => $_REQUEST['start'],
'max' => $modSettings['search_results_per_page'],
'is_approved' => 1,
'current_member' => $user_info['id'],
'approve_boards' => !empty($approve_boards) ? $approve_boards : array(0),
)
);
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 27, 2019, 06:14:30 AM
Did you use the "releases" tab or the green "clone or download" button -> "download zip"?
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: gecitli on November 27, 2019, 07:19:06 AM
I've been using smf for years how to install? I know the purpose of opening this thread is to report an error?
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 27, 2019, 07:41:22 AM
Yes, we heard you, the error will be "logged" on Github and will be fixed. (Thanks!)

I'm just trying to understand how you ended up in the situation you are in. Because if you did download the actual rc2 release file, you shouldn't see this problem, it was introduced later on. This is why I'm trying to find out what happened.
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: SRHT on November 27, 2019, 08:03:49 AM
same mistake.


Type of error: Undefined
8: Undefined variable: approve_query
http://localhost:8080/smf/index.php?action=search2
C:/wamp64/www/smf/Sources/Search.php (Line 1828)



Type of error: Undefined
8: Undefined variable: approve_query
http://localhost:8080/smf/index.php?action=search2
C:/wamp64/www/smf/Sources/Search.php (Line 1715)


Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: Arantor on November 27, 2019, 10:25:43 AM
Quote from: gecitli on November 27, 2019, 07:19:06 AM
I've been using smf for years how to install? I know the purpose of opening this thread is to report an error?

Yes, but depending on when you got it from GitHub and how, it can affect us fixing the bug, that's why we ask these questions.

That's why I asked for the commit, as that tells us *exactly* which code you're looking at. Because what's on GitHub up to multiple times a day...
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: albertlast on November 27, 2019, 10:33:05 PM
As  always use the nightly download would  be the easy way...
Title: Re: Search error in 2.1 RC2 GitHub Version
Post by: m4z on November 28, 2019, 05:12:44 PM
I now reported this as GH#5877 (https://github.com/SimpleMachines/SMF2.1/issues/5877).