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

Fixed Undefined index: HTTP_USER_AGENT

xfrocks

Well-known member
#1
Similar to this which said it has been fixed. We still get this with v1.5.12 though.

Code:
ErrorException: Undefined index: HTTP_USER_AGENT - library/XenForo/ViewPublic/Helper/Editor.php:224
#0 /xxx/xenforo/library/XenForo/ViewPublic/Helper/Editor.php(224): XenForo_Application::handlePhpError(8, 'Undefined index...', '/xxx/...', 224, Array)
#1 /xxx/xenforo/library/XenForo/ViewPublic/Helper/Editor.php(42): XenForo_ViewPublic_Helper_Editor::supportsRichTextEditor()
#2 /xxx/xenforo/library/xxx/ViewPublic/Thread/Create.php(10): XenForo_ViewPublic_Helper_Editor::getEditorTemplate(Object(xxx_ViewPublic_Thread_Create), 'xxx...', '', Array)
#3 /xxx/xenforo/library/XenForo/ViewRenderer/Abstract.php(227): xxx_ViewPublic_Thread_Create->renderHtml()
#4 /xxx/xenforo/library/XenForo/ViewRenderer/HtmlPublic.php(71): XenForo_ViewRenderer_Abstract->renderViewObject('xxx...', 'Html', Array, 'thread_create')
#5 /xxx/xenforo/library/XenForo/FrontController.php(606): XenForo_ViewRenderer_HtmlPublic->renderView('XenForo_ViewPub...', Array, 'thread_create', NULL)
#6 /xxx/xenforo/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#7 /xxx/xenforo/index.php(13): XenForo_FrontController->run()
#8 {main}
Apparently the second if block should be inside the first one?

PHP:
public static function supportsRichTextEditor()
{
   $showWysiwyg = true;
   if (!empty($_SERVER['HTTP_USER_AGENT']))
   {
      ...
   }

   if (self::$_editorIds && preg_match('#(android|iphone os|ipad; cpu os) (\d+)(\.|_)(\d+)#i', $_SERVER['HTTP_USER_AGENT'], $match))
   {
      $showWysiwyg = false; // there's a problem with multiple editors on the same page in android and iOS
   }

   return $showWysiwyg;
}
 

Mike

XenForo developer
Staff member
#2
This is fixed now -- if we don't have a user agent, we just assume we have support and bail out immediately.