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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 05-22-2011, 05:27 PM
ZERO <ibis> ZERO <ibis> is offline
 
Join Date: Dec 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh I had it generating txt files that outputted the values being passed to ensure they were working. I even had ones for various parts of the functions so I know it runs fine until it gets into that loop and does the if statement checks. However I feed that loop with hard coded values of lets say 16 for both paidsub_build and useradmin_update_save but it does not work on paidsub_build and does work on useradmin_update_save

It is mind blowing. Even with the variables set to the same values how can I get different results from the same function where the only difference is that it is being run on a different hook.

The part where is breaks down is here:
PHP Code:
$sbusergroups explode(","$sbmemgroups2);

foreach(
$sbusergroups as $sbgroup)
    {
        
$sbgroupint intval($sbgroup); 
The above code works fine in useradmin_update_save but breaks on paidsub_build even when they are for a fact processing the exact same input.

I got a b-day and graduation parties to get to today so I will deal with this more tomorrow. Thanks for all the help so far

--------------- Added [DATE]1306090100[/DATE] at [TIME]1306090100[/TIME] ---------------

Here is a good chunk of the functions (slightly edited)

PHP Code:
function first($userid$findstuff true$sbaid ""$sbmemgroups "")
{
    global 
$db$vB_Groups$sB_Groups$sB_Names$sB_Server$sB_WebClan$sB_WebDefault$sB_WebUpper$sB_WebProbation$sB_WebRoot$sbaidfield;

    
$fp fopen('d_userid.txt''w');
        
fwrite($fp$userid);
        
fclose($fp);    
    
    
    if (
$findstuff)
    {
        
$sbquery $db->query_read("
            SELECT " 
TABLE_PREFIX "userfield.field9
            FROM " 
TABLE_PREFIX "userfield
            WHERE " 
TABLE_PREFIX "userfield.userid = $userid
        "
);

        
$sbrow $db->fetch_array($sbquery);
        
$sbaid $sbrow['field9'];
        
        
$sbquery2 $db->query_read("
            SELECT membergroupids
            FROM " 
TABLE_PREFIX "user
            WHERE userid = 
$userid
        "
); 
        
        
$sbrow2 $db->fetch_array($sbquery2);
        
$sbmemgroups $sbrow2['membergroupids']; 
        
        
$fp fopen('data.txt''w');
        
fwrite($fp$sbmemgroups);
        
fclose($fp);
        
    }    
    
    
function2($userid$sbaid$sbmemgroups);
}

function 
function2($userid$sbaid$sbmemgroups)
{
    global 
$db$vB_Groups$sB_Groups$sB_Names$sB_Server$sB_WebClan$sB_WebDefault$sB_WebUpper$sB_WebProbation$sB_WebRoot$sbaidfield;
    
    
$fp fopen('data2.txt''w');
        
fwrite($fp$sbmemgroups);
        
fclose($fp);    
        
    
$sbmemgroups2 file_get_contents('data2.txt');
    
    
$sbusergroups explode(","$sbmemgroups2);

    
$sbnever false;
    
$sbalways false;
    
$sbpaid false;

    
//Determin what admin type the user is
    
foreach($sbusergroups as $sbgroup)
    {
        
$sbgroupint intval($sbgroup);

        if (
$sbgroupint == 10)
        {
            
$sbnever true;
        }
        else if (
$sbgroupint == 9)
        {
            
$sbalways true;
        }
        else if (
$sbgroupint == 16)
        {
        
$fp fopen('d_should_have_admin.txt''w');
                
fwrite($fp$sbgroupint);
                
fclose($fp);
            
$sbpaid true;
        }
    }

    
//Assign privlages to the selected type
    
if (!$sbnever)
    {
        if (
$sbalways || $sbpaid)
        {
        
$fp fopen('d_has_admin.txt''w');
                
fwrite($fp$sbpaid);
                
fclose($fp); 
The last line shown here never gets run on paidsub_build nor does the d_should_have_admin.txt this is even if I just read contents directly drom data2.txt from when it ran via the other hook and this applies to all variables not just the $sbmemgroups2

Something goes wrong in that foreach loop and only does so in paidsub_build even when the loop is fed with the same input.

While I am new to programing in vbb I have coded for years in general html php sourcepawn java ect and never have I seen a situation where you can feed a function the same input and get different outputs where there was not complex math or randomization involved... these results are blowing my mind and the only think I can think is that the function that the paidsub_hook is running in some how forcefully prevents the running of that loop. However, that would mean that we need to get a developer or someone that really understands the vb code in and out to explain just what is going wrong here.
Reply With Quote
 


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 06:07 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.07364 seconds
  • Memory Usage 2,902KB
  • Queries Executed 12 (?)
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
  • (4)bbcode_code
  • (17)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (17)post_thanks_box
  • (17)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (17)post_thanks_postbit_info
  • (17)postbit
  • (17)postbit_onlinestatus
  • (17)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete