1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Being spammed with server errors after initialising Xenforo environment

Discussion in 'XenForo Development Discussions' started by AUSFIFA, Nov 10, 2015.


    AUSFIFA Member

    I have a PHP website which has its own user accounts/log in system, and I've integrated XF into that system using a bridge. When a user registers an account, a Xenforo account is also created for that user, and they are automatically logged into this XF account when they log in to my site. I'm using the helper class that can be found here: https://gist.github.com/shadab16/722240

    This is the code I'm using to initialise Xenforo:

    $xenforoRoot = '/home/ausfifac/public_html/forums/';
    require($xenforoRoot . '/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($xenforoRoot . '/library');
    GeekPoint_Symfony::initializeXenforo($xenforoRoot, $startTime);

    This bit of code is included at the start of every file on my site.

    It works great and all, but I am now constantly getting spammed with "Undefined variable" error messages in my error log. Every time a page is hit on my site, errors are generated. After a few days I'll have roughly 1 million error messages, and it starts to impact on my disk space.

    It throws an error for almost every single variable on my pages, even when there are no actual errors present in my code. Things such as:

    Undefined variable:
    Undefined index:
    Trying to get property of non-object

    Here's a stack trace for one of the errors:
    #0 /home/ausfifac/public_html/inc/club/overview.php(127): XenForo_Application::handlePhpError(8, 'Undefined varia...', '/home/ausfifac/...', 127, Array)
    #1 {main}

    Is there any way I can solve this issue?
  2. Chris D

    Chris D XenForo Developer Staff Member

    What is line 127 of overview.php?

    AUSFIFA Member

    $rivals_division+= $stats[$team . "_division"];

    It seems to happen to all variables no matter what the code is.
  4. Chris D

    Chris D XenForo Developer Staff Member

    You would need to make sure any variable you use is defined, or you verify a variable or array index exists before trying to access it.
    Marcus likes this.

    AUSFIFA Member

    You are right. After looking over the error log again, it seems like they're all legit errors. They just never appeared until I started using the XF environment, so I thought there was something wrong with the server error log. Thanks.

    While you're here, would you mind taking a look at this issue I'm having?

Share This Page