Fixed ErrorException: [E_NOTICE] Undefined index: args src/XF/Error.php:235

Poofcakes

Member
Updated to 2.1 yesterday. Getting server errors when someone tries to register or login.

Line 235 in Error.php is
Code:
foreach ($traceElement['args'] AS $key => $arg)

Stack trace
Code:
#0 src/XF/Error.php(235): XF::handlePhpError(8, '[E_NOTICE] Unde...', '...', 235, Array)
#1 src/XF/Error.php(203): XF\Error->buildTraceArgs(Array)
#2 src/XF/Error.php(155): XF\Error->buildTraceString(Object(ErrorException))
#3 src/XF/Error.php(123): XF\Error->getTraceStringFromThrowable(Object(ErrorException))
#4 src/XF.php(182): XF\Error->logException(Object(ErrorException), true, '', false)
#5 src/XF/Mvc/Dispatcher.php(217): XF::logException(Object(ErrorException), true)
#6 src/XF/Mvc/Dispatcher.php(108): XF\Mvc\Dispatcher->handleControllerError(Object(ErrorException), true, Object(XF\Pub\Controller\Login), Array)
#7 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#9 src/XF.php(390): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}

Request state
Code:
array(4) {
  ["url"] => string(86) "/index.php?login/two-step&_xfRedirect=https%3A%2F%2Fforum.mapleunity.com%2F&remember=1"
  ["referrer"] => string(50) "https://forum.mapleunity.com/index.php?login/login"
  ["_GET"] => array(3) {
    ["login/two-step"] => string(0) ""
    ["_xfRedirect"] => string(29) "https://forum.mapleunity.com/"
    ["remember"] => string(1) "1"
  }
  ["_POST"] => array(0) {
  }
}
 
I'll move this to bugs as we should adjust this code to protect against this. However, a few things come to mind:

1. We actually catch all exceptions here so I'm not actually sure how this exception is being logged unless there's an opcode cache issue (which we have seen at times).

2. This is being logged in the process of logging another error. Given that this is a notice, normal XF behavior wouldn't stop execution, so presumably there should be a paired error log entry to go with it which is the "real" error. (Though given that this is being logged when it shouldn't, I'm not confident in that.)
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
Prevent an error when building the backtrace of an error message that has no arguments.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Back
Top Bottom