Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2011, 06:32 PM
pnhltt pnhltt is offline
 
Join Date: Apr 2011
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 12-19-2011, 06:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'] = '';
        }
    } 
Reply With Quote
2 благодарности(ей) от:
Macsee, pnhltt
  #3  
Old 12-19-2011, 08:07 PM
pnhltt pnhltt is offline
 
Join Date: Apr 2011
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you suggesting we change first for the second?

PS.
It took me a while to see the difference, let alone understand why couple of brackets should cause any problems...
Reply With Quote
  #4  
Old 12-19-2011, 09:01 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 12-19-2011, 11:07 PM
pnhltt pnhltt is offline
 
Join Date: Apr 2011
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

being stupid and cannot find how to do it and where...
Reply With Quote
  #6  
Old 12-19-2011, 11:12 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 .
Reply With Quote
  #7  
Old 12-23-2011, 10:23 PM
pnhltt pnhltt is offline
 
Join Date: Apr 2011
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did what was suggested, everything works. Thanks!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:59 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07063 seconds
  • Memory Usage 2,237KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (2)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete