vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   What does this mean and what do we do about it? (https://vborg.vbsupport.ru/showthread.php?t=275688)

pnhltt 12-19-2011 06:32 PM

What does this mean and what do we do about it?
 
If one clicks "get the results of the poll" without voting then one gets such a notice:

Warning: Invalid argument supplied for foreach() in [path]/poll.php on line 688

What does it mean and what do we do to fix it?

Thank you.

kh99 12-19-2011 06:43 PM

That looks like a bug to me. The code in poll.php looks like this (the foreach line is 688):

PHP Code:

        while ($name $db->fetch_array($public))
        {
            
$clc++;
            
fetch_musername($name);
            
$last[$name['voteoption']] = $clc;
            
$name['comma'] = $vbphrase['comma_space'];
            
$allnames[$name['voteoption']][$clc] = $name;
        }
    }

    
// Last elements
    
foreach ($last AS $voteoption => $value)
    {
        
$allnames[$voteoption][$value]['comma'] = '';
    } 


and I believe it should look like this:

PHP Code:

        while ($name $db->fetch_array($public))
        {
            
$clc++;
            
fetch_musername($name);
            
$last[$name['voteoption']] = $clc;
            
$name['comma'] = $vbphrase['comma_space'];
            
$allnames[$name['voteoption']][$clc] = $name;
        }

        
// Last elements
        
foreach ($last AS $voteoption => $value)
        {
            
$allnames[$voteoption][$value]['comma'] = '';
        }
    } 


pnhltt 12-19-2011 08:07 PM

Are you suggesting we change first for the second?

PS.
:D It took me a while to see the difference, let alone understand why couple of brackets should cause any problems...

kh99 12-19-2011 09:01 PM

Yes, I believe that will fix the issue. As you probably figured out, the only difference is that one closing bracket is moved down so that the foreach is inside.

pnhltt 12-19-2011 11:07 PM

being stupid and cannot find how to do it and where...

kh99 12-19-2011 11:12 PM

You'd need to edit poll.php. So download it from your server if you don't already have it on your local computer, then open it with a programming editor (like notepad++ - if you use wordpad or something like that it can cause problems). Next I would save a copy somewhere, then edit it and go to line 688. You should see code like is posted above. Make it look something like the second code (the indenting isn't important). Then upload it to your server, overwriting the one that's there. Then check if polls are working on your site, and if they aren't just upload the unedited copy you saved.

ETA: ...BTW, looks like it's a known bug that'll be fixed in the next version http://tracker.vbulletin.com/browse/VBIV-13614 .

pnhltt 12-23-2011 10:23 PM

Did what was suggested, everything works. Thanks!


All times are GMT. The time now is 01:23 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.01905 seconds
  • Memory Usage 1,736KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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