PDA

View Full Version : Custom Plugin Generating Weird Error


vbplusme
07-09-2009, 11:13 AM
First Here is the error:

Warning: Cannot use a scalar value as an array in [path]\includes\functions_search.php on line 607

After a few attempts at trying to figure out where this error is coming from I discovered that my custom text display plugin is somehow responsible for it.

I created a table and loaded some custom text in it. My plugin randomly gets a number to text comments and displays them in the side bar on my page, doesn't interact with the forums at all as far as I coded it. BUT, the error message seems to indicated that my script is somehow touching the forum search code, no idea how.

Line 607 in functions_search.php is :


$display['forums'] = array();


The block of code where it is appears to be checking what forums are related to the query and display['forums'] appears to be empty so I am not seeing why the type assignment is not happy. My plugin code doesn't touch any of this stuff as far as I know.

Here is the block of code where the failing line is:

// now if there are any forumids we have to query, work out their child forums
if (empty($forumids))
{
$forumchoice = array();
$display['forums'] = array(); // this is line 607
}
else
{
// set $forumchoice to show the returned forumids
#$forumchoice = implode(',', $forumids);

// put current forumids into the display table
$display['forums'] = $forumids;


Anybody seen anything like this before? I would really like to understand how / why my code is affecting the search utility. At the moment I don't have a clue about it. or Why it might be. My Plugin doesn't contain ANY of the variables that are in this block of code.

I have tried my code with and without using output buffering with the same error showing up in the search utility?

SCSCSC
07-12-2009, 04:42 AM
try
$display = array();

vbplusme
07-12-2009, 05:47 AM
HA! A classic textbook case of overlooking the "obvious" ... Thanks very much! I was looking for a much more complex solution, I wrapped it in a "if !empty" conditional and that worked too but I thought it was not the correct way to handle it. I appreciate your direction. Again, thanks much.