Fixed ErrorException: Undefined index: name

Vincent

Well-known member
Error Info:
ErrorException: Undefined index: name - library/XenForo/ControllerPublic/Register.php:425
Generated By: Unknown Account, Feb 3, 2012
Stack Trace
Code:
#0 /home7/.../library/XenForo/ControllerPublic/Register.php(425): XenForo_Application::handlePhpError()
#1 /home7/.../library/XenForo/FrontController.php(310): XenForo_ControllerPublic_Register->actionFacebook(Object(XenForo_RouteMatch))
#2 /home7/.../library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch()
#3 /home7/.../index.php(13): XenForo_FrontController->run()
#4 {main}

Request State
Code:
array(3) {
  ["url"] => string(262) "http://www.hlxbans.net/register/facebook?code=AQDu0KlJz2cg73st_DPqDl-9h26JKDPcvBXpo504mnWY2pzigEG0J2vBsToOdNhrYSmVu1AxYsZhBtqm58vKrn02mEVjf5nKNrFf7RJ3n4YdzprAHFQGCA5q0euMg8MyGRCKJyrrwrAtP_TP2aySJRHKbchlSIs059JIgbXYucYNDZB91I2NBxfpig-5a8vX8lBZu1vi8UOQcTeOxbqb4g9p"
  ["_GET"] => array(1) {
    ["code"] => string(216) "AQDu0KlJz2cg73st_DPqDl-9h26JKDPcvBXpo504mnWY2pzigEG0J2vBsToOdNhrYSmVu1AxYsZhBtqm58vKrn02mEVjf5nKNrFf7RJ3n4YdzprAHFQGCA5q0euMg8MyGRCKJyrrwrAtP_TP2aySJRHKbchlSIs059JIgbXYucYNDZB91I2NBxfpig-5a8vX8lBZu1vi8UOQcTeOxbqb4g9p"
  }
  ["_POST"] => array(0) {
  }
}
 
Probably just can't assume Facebook will always give a user name (obviously).

If it's causing issues for you now, and can't wait for an official fix, you can change this line:
PHP:
$origName = $fbUser['name'];

to this:
PHP:
if (!isset($fbUser['name']) $fbUser['name'] = '';
$origName = $fbUser['name'];
 
Probably just can't assume Facebook will always give a user name (obviously).

If it's causing issues for you now, and can't wait for an official fix, you can change this line:
PHP:
$origName = $fbUser['name'];

to this:
PHP:
if (!isset($fbUser['name']) $fbUser['name'] = '';
$origName = $fbUser['name'];

Thanks!
It's not that important, I just saw the error and was wondering what it was.
Appreciatie the fix though, I hope it gets included in 1.1.3 :)
 
Just a quick note, I may be mistaken by Shawn's fix appears to be missing an extra ")" to close the if condition?
PHP:
if (!isset($fbUser['name'])) $fbUser['name'] = '';
$origName = $fbUser['name'];
Without that, registration attempts get a blank page.
 
Top Bottom