• 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

#1
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?
 

Chris D

XenForo developer
Staff member
#4
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.