1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Fixed Errors in server error log

Discussion in 'Stock Trader Resolved Bug Reports' started by Deebs, Mar 28, 2013.

  1. Deebs

    Deebs Member Showcase Pickem

    Hi Bob,

    When I first made available Stock Trader there was no ability to limit the exchanges allowed to be used. Subsequently I have disabled all but the LSE, unfortunately I have one user who has purchased shares from another Exchange and it is filling my logs up every hour when your cron runs.

    I tried looking through the tables and deleting the offending share from the user but it pops back (not sure if it has been cached or what). Anyway, can you tell me how to remove share from a user?

    Code:
    ErrorException: Undefined index: SMSN.L - library/NFLJ/StockTrader/Model/Stock.php:1052
    Generated By: Unknown Account, Today at 2:01 AM
     
  2. Bob

    Bob Developer Staff Member

    You can delete stock from the Admin CP now :) Click on Stock Holder Management, click on the individual that has that stock, then click X to delete it from the system.

    The only place symbols are stored are in the xf_nflj_stocktrader_stock table (in the symbol field). Could be a case where the individual has multiple transactions and you are not getting them all removed.

    I'd just run a delete against the xf_nflj_stocktrader_stock table where symbol like SMSN.L

    btw, .L = LSE (just so you know)
     
  3. Deebs

    Deebs Member Showcase Pickem

    Thanks :)

    Right had a look and found 2 errors when looking at the users under Stock Holder Management:

    Code:
    Server Error
     
    Undefined index: SMSN.L
     
    XenForo_Application::handlePhpError() in NFLJ/StockTrader/Model/Stock.php at line 567
    NFLJ_StockTrader_Model_Stock->formatUserStockInfo() in NFLJ/StockTrader/ControllerAdmin/Portfolio.php at line 46
    NFLJ_StockTrader_ControllerAdmin_Portfolio->actionIndex() in XenForo/FrontController.php at line 310
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    XenForo_FrontController->run() in /xxx/admin.php at line 13
    
    Code:
    Server Error
     
    Division by zero
     
    XenForo_Application::handlePhpError() in NFLJ/StockTrader/Model/Stock.php at line 586
    NFLJ_StockTrader_Model_Stock->formatUserStockInfo() in NFLJ/StockTrader/ControllerAdmin/Portfolio.php at line 46
    NFLJ_StockTrader_ControllerAdmin_Portfolio->actionIndex() in XenForo/FrontController.php at line 310
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    XenForo_FrontController->run() in /xxxx/admin.php at line 13
    
    The first is my culprit, not sure about the second one...
     
  4. Bob

    Bob Developer Staff Member

    Division by Zero is something that I should handle in the code, so I think I should move this into the bugs forum to remind me to check it out. Are those being thrown or just logged?
     
  5. Deebs

    Deebs Member Showcase Pickem

    The Div by zero is only shown under Stock Holder Management.

    Btw, I cannot delete the SMSN.L under Stock Holder Management due to the undefined index error.
     
  6. Bob

    Bob Developer Staff Member

    You'll need to do what I suggested above them and do a delete from on the table to remove all instances of it. I've got a prototye of a Remove Symbol function that will allow you to enter a stock symbol and have it mass removed from Stock Trader (great from problem stocks like this one). It needs a lot more testing before I will add it to core tho.
     
    Deebs likes this.
  7. Deebs

    Deebs Member Showcase Pickem

    Bob,

    Just to add another error to this one,

    Recently of my users who has purchased stock now cannot click the ST link as he immediately gets a server error. When I go into Stockholder management his username is not listed anymore and he assures me he has not deleted anything. Here is the error:

     
  8. Bob

    Bob Developer Staff Member

    Thats one that I'd need to look at the DB to see all stock trader records associated with his user_id. Can you hook my up with phpmyadmin access and his user_id? My guess is that a stock he purchased is defunct.
     
  9. Deebs

    Deebs Member Showcase Pickem

    Ah, unfortunately I do not have PHPMyAdmin installed anywhere and I am not about to install that piece of software. If you want I can run some queries for you.
     
  10. Bob

    Bob Developer Staff Member

    no probs... just give me a dump of his stuff from the below 2 tables.

    xf_nflj_stocktrader_stock ( all records in this table by his user_id)

    select * from xf_nflj_stocktrader_stock where user_id = ?

    xf_nflj_stocktrader_stock_sold ( all records in this table by his user_id)

    select * from xf_nflj_stocktrader_stock_sold where user_id = ?
     
  11. Deebs

    Deebs Member Showcase Pickem

    Here is result of first query:

    Did you mean xf_nflj_stocktrader_stock_sold_log? If so
     
  12. Bob

    Bob Developer Staff Member

    hmmm both those stocks are legit and have no errors. I just added the exact transactions above to one of my test accounts, sold them as he did and everything works as it should. The user should get the landing page that has the big blurb of text on it as he doesn't own any stock.

    That error also doesn't make sense. Its saying that the symbols variable is "undefined" ( Undefined variable: symbols ) However, $symbols is defined at line 43 or 58 (in an if else statement so its defined one way or another way). Im thinking that it probably doesn't like $symbols being defined as a bool and then using count on it... if you don't mind, can you do the below edit. It just defines $symbols as an empty array instead of false, but it should stop the above error and might be why he can't access the page.

    Can you change line 58 on /library/NFLJ/StockTrader/ControllerPublic/Index.php?

    change:
    line 58: $symbols = false;

    to:
    line 58: $symbols = array();
     
  13. Deebs

    Deebs Member Showcase Pickem

    Bob,

    I do not have that line at all in the file you specified. Current version of StockTrader is 1.0.0, actually just done a grep and it does not exist in any file under StockTrader.
     
  14. Bob

    Bob Developer Staff Member

    I just download the 1.0.0 zipfile from here and line 58 is $symbols = false;

    Here is a SNIP from the file.. lines 41 - 59 you can clearly see that on line 43 and 58 $symbols being defined.

    PHP:
            if ($totalSymbols $stStockModel->getSymbolCountByUser($visitor['user_id']))           
            {
                
    $symbols $stStockModel->getSymbolsByUser($visitor['user_id'], array('perPage' => $stockSymbolsPerPage'page' => $page));
               
                
    $currentStockInfo $stStockModel->getQuotes($symbols);
           
                
    $userStockInfo $stStockModel->getStockByUserAndSymbols($visitor['user_id'],$symbols);
                
    $userStockInfo $stStockModel->formatUserStockInfo($userStockInfo$currentStockInfo);
           
                foreach (
    $userStockInfo AS $symbolId => $stock)
                {
                    
    $userStockInfo[$symbolId]['canSellStock'] = $stStockModel->canSellStock($stock);
                }
            }
            else
            {
                
    $userStockInfo false;
                
    $symbols false;
            }
     
  15. Bob

    Bob Developer Staff Member

    My guess (and its only a GUESS) is that some of the older version files didn't get over written. Maybe download 1.0.0 again and upload the files making sure they infact are over written. Should only take a few minutes :)
     
  16. Deebs

    Deebs Member Showcase Pickem

    Strange, i've redone all the files and am currently "upgrading" the mod. Will report back when the user is online and has tried again for me. Thanks for your help in this :)
     
  17. Bob

    Bob Developer Staff Member

    Always a pleasure helping out good peeps like yourself :) I should be on for 12+ more hours until I hit the sack, so we'll get this "right"!
     
    Deebs likes this.
  18. Deebs

    Deebs Member Showcase Pickem

    Good news, reapplying the files and running the upgrade seems to have fixed it. Thanks for your help Bob, superb customer service.
     
    Bob likes this.
  19. Bob

    Bob Developer Staff Member

    Outstanding news! Glad its all sorted :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.