SOLVED: Joomla global search generates Fabrik related error

Status
Not open for further replies.

juuser

Well-Known Member
Hello,

When using Joomla global search, i get about 100 following error line before search results:

Warning: in_array() expects parameter 2 to be array, object given in C:\Apache24\htdocs\components\com_fabrik\models\element.php on line 6302

Error reporting is set to Simple. What could cause this?

Thanks :)
 
Can you look around that line / file in the error, you should see this code:

PHP:
        if (!isset($searchElements->search_elements))
        {
            return false;
        }
 
        if (in_array($this->getId(), $searchElements->search_elements))
        {
            $advancedMode = $listParams->get('search-mode-advanced');
 
            return $this->canIncludeInSearchAll($advancedMode);
        }

... and insert this:

PHP:
var_dump($searchElements);exit;

... between those two if statements (i.e. on the line immediately before the second "if"). Do another search, and it should just output some debug info on an otherwise blank page. Copy and paste that output here.

The "fix" is to modify that first "if" so it reads:

Code:
        if (!isset($searchElements->search_elements) || !is_array($searchElements->search_elements))

.... but I'd like to know what $searchElements is getting set to, if it isn't an object with a search_elements array in it.

-- hugh
 
Hi,
Var_dump output looks like this:
object(stdClass)#1369 (1) { ["search_elements"]=> array(2) { [0]=> string(2) "42" [1]=> string(2) "70" } }

And thanks, modifying the code like you succested solved the issue!

BR,
Martin
 
Just to inform you that this probably didn't get to Github as i get this error again after Github update.
 
Thanks Hugh! It's there now. I probably made lats update from Github just before that commit :)
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top