vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom Plugin Generating Weird Error (https://vborg.vbsupport.ru/showthread.php?t=218219)

vbplusme 07-09-2009 11:13 AM

Custom Plugin Generating Weird Error
 
First Here is the error:

Quote:

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 :

PHP Code:

        $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:

PHP Code:

    // 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.


All times are GMT. The time now is 01:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01727 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete