Error : Undefined variable...help!

Marcel

Active member
This is a bit of code in one of my cron jobs :
Lines 79 and 80....
PHP:
           $logInfo = "======  START MOVING THREADS  ======";
           XenForo_Helper_File::log('cron_moveSortedThreads',$logInfo, TRUE);

For some reason it's throwing an error when the cron job runs :

ErrorException: Undefined variable: logInfo - library/MaB/Mod/CronEntry/MoveSortedThreads.php:80
Generated By: Unknown Account, 2 minutes ago
Stack Trace
#0 /xendev/library/MaB/Mod/CronEntry/MoveSortedThreads.php(80): XenForo_Application::handlePhpError(8, 'Undefined varia...', '/xendev/...', 80, Array)
#1 [internal function]: MaB_Mod_CronEntry_MoveSortedThreads::moveThreads(Array)
#2 /xendev/library/XenForo/Model/Cron.php(357): call_user_func(Array, Array)
#3 /xendev/library/XenForo/Deferred/Cron.php(24): XenForo_Model_Cron->runEntry(Array)
#4 /xendev/library/XenForo/Model/Deferred.php(295): XenForo_Deferred_Cron->execute(Array, Array, 7.9999980926514, '')
#5 /xendev/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 7.9999980926514, '', false)
#6 /xendev/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#7 /xendev/deferred.php(23): XenForo_Model_Deferred->run(false)
#8 {main}
Request State
array(3) {
["url"] => string(26) "http://xendev/deferred.php"
["_GET"] => array(0) {
}
["_POST"] => array(4) {
["_xfRequestUri"] => string(1) "/"
["_xfNoRedirect"] => string(1) "1"
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"

It's really bugging me. The variable has clearly been defined before use. The strange thing is, I also have the same two lines later on (closing the end of the log entry), which if I remove these two lines (to get the code to continue) they work!

I'm running PHP 5.4.37 via AMPPS and Eclipse.
I'm obviously running locally but I've just upgraded to macOS Beta (Latest one). I'm wondering if it's something to do with that?
 
Completely ignore me! I've found it. Preceding line 79 was an if statement that should have had a following curly bracket that had buggered off somewhere further down the code.

I'm a doofus, but Ill leave this up here for everyone to point and laugh :)
 
Back
Top Bottom