MyBB Community Forums

Full Version: search results display with invalid sid
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Clarification and expansion of a warning reported earlier.
A member bookmarked a search link showing results, and the sid was expired. (Search results are dropped from the table after 24 hours).

Warning [2] Trying to access array offset on value of type null - Line: 63 - File: search.php PHP 8.0.28 (Linux)
Fixed by changing line 63 from
	if(!$search['sid'])
to
	if(isset($search['sid']) && !$search['sid'])

Except that triggers more warnings elsewhere in lines 107, 155, 249 and 726
Warning [2] Trying to access array offset on value of type null - Line: 107 - File: search.php PHP 8.0.28 (Linux)

Change line 107 from
			if($search['resulttype'] == "threads")
to
			if(isset($search['resulttype']) && $search['resulttype'] == "threads")

Change line 155 from
	if($search['keywords'])
to
	if(isset($search['keywords']))

Change line 249 from
	if($search['resulttype'] == "threads")
to
	if(isset($search['resulttype']) && $search['resulttype'] == "threads")

Change line 726 from
		if(!$search['posts'])
to
		if(empty($search['posts']))