Bug Parse error: syntax error, unexpected

Discussion in '[bd] Widget Framework' started by Nathan, Sep 8, 2018.

  1. Nathan

    Nathan New Member

    Hello,

    Recently upgraded our framework and php, and we're getting this error on all pages:

    Code:
    [B]Parse error[/B]: syntax error, unexpected '{' in [B]/home/oursite/public_html/library/WidgetFramework/WidgetRenderer.php(554) : eval()'d code[/B] on line [B]1[/B]
    Additionally, in our server error area, we're getting these errors:

    Code:
    ErrorException: Undefined variable: result - library/WidgetFramework/WidgetRenderer.php:557
    Generated By: Unknown Account, 1 minute ago
    Code:
    ErrorException: Fatal Error: syntax error, unexpected '{' - library/WidgetFramework/WidgetRenderer.php(554) : eval()'d code:1
    Generated By: Unknown Account, 2 minutes ago
    Stack Trace
    #0 [internal function]: XenForo_Application::handleFatalError()
    #1 {main}
    Request State
    array(3) {
      ["url"] => string(83) "https://www.oursite.net/threads/etc/page-4"
      ["_GET"] => array(0) {
      }
      ["_POST"] => array(0) {
      }
    }
     
  2. Nathan

    Nathan New Member

    Forgot to mention, we're on widget framework 2.6.3, xenforo 1.5.20, and php 7.2.0. I have since downgraded back to framework 2.5.9, and now we are getting these errors:

    Code:
    ErrorException: Fatal Error: syntax error, unexpected '{' - library/WidgetFramework/WidgetRenderer.php(498) : runtime-created function:1
    Generated By: Unknown Account, A moment ago
    Stack Trace
    #0 [internal function]: XenForo_Application::handleFatalError()
    #1 {main}
    Request State
    array(3) {
      ["url"] => string(86) "https://www.oursite.net/threads/thread.3/page-1251"
      ["_GET"] => array(0) {
      }
      ["_POST"] => array(0) {
      }
    }
     
  3. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Hi there,

    Sorry for the late response.

    It looks like one of your widget is having a bad syntax expression. According to the error log, it may be one of the thread_view widgets. Can you check those to see if any of them are using widget expression? You can copy/paste it here and I will correct the bad syntax.
     
  4. Nathan

    Nathan New Member

    Thanks! None of my thread_view widgets are running expressions. I have one in clear sidebar that has an expression like this: !in_array({$contentTemplate}, array('conversation_view','resource_description', 'resource_index'))
     
  5. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    That one looks wrong, it should be:

    Code:
    !in_array($contentTemplate, array('conversation_view', 'resource_description', 'resource_index'))
     
    1. Nathan

      Nathan New Member

      Nathan @xfrocks Thank you, I'll test that now.
       
      xfrocks likes this.
      1
    2. Nathan

      Nathan New Member

      Nathan @xfrocks Any thoughts?
       
  6. Nathan

    Nathan New Member

    Tried that, got an even bigger error!

    Code:
    ErrorException: Undefined variable: contentTemplate - library/WidgetFramework/WidgetRenderer.php(498) : runtime-created function:1
    Generated By: Unknown Account, 1 minute ago
    Stack Trace
    #0 /home/public_html/library/WidgetFramework/WidgetRenderer.php(498) : runtime-created function(1): XenForo_Application::handlePhpError(8, 'Undefined varia...', '/home/styleforu...', 1, Array)
    #1 [internal function]: __lambda_func(Array)
    #2 /home/public_html/library/WidgetFramework/WidgetRenderer.php(502): call_user_func('\x00lambda_23', Array)
    #3 /home/public_html/library/WidgetFramework/WidgetRenderer.php(588): WidgetFramework_WidgetRenderer->_executeExpression('!in_array($cont...', Array)
    #4 /home/public_html/library/WidgetFramework/WidgetRenderer/Empty.php(35): WidgetFramework_WidgetRenderer->render(Array, 'thread_view', Array, Object(XenForo_Template_Public), '')
    #5 /home/public_html/library/WidgetFramework/Core.php(397): WidgetFramework_WidgetRenderer_Empty->render(Array, 'thread_view', Array, Object(XenForo_Template_Public), '')
    #6 /home/public_html/library/WidgetFramework/Core.php(316): WidgetFramework_Core->_renderWidgetsFor('thread_view', Array, Object(XenForo_Template_Public), '')
    #7 /home/public_html/library/WidgetFramework/Listener.php(126): WidgetFramework_Core->renderWidgetsFor('thread_view', Array, Object(XenForo_Template_Public), Array)
    #8 [internal function]: WidgetFramework_Listener::template_post_render('thread_view', '\n\n\t\n\t\n\t\n\n\n\n\n\n\n\n...', Array, Object(XenForo_Template_Public))
    #9 /home/public_html/library/XenForo/CodeEvent.php(58): call_user_func_array(Array, Array)
    #10 /home/public_html/library/XenForo/Template/Abstract.php(205): XenForo_CodeEvent::fire('template_post_r...', Array, 'thread_view')
    #11 /home/public_html/library/XenForo/Template/Public.php(110): XenForo_Template_Abstract->render()
    #12 /home/public_html/library/XenForo/ViewRenderer/HtmlPublic.php(124): XenForo_Template_Public->render()
    #13 /home/public_html/library/XenForo/FrontController.php(662): XenForo_ViewRenderer_HtmlPublic->renderContainer(Object(XenForo_Template_Public), Array)
    #14 /home/public_html/library/XenForo/FrontController.php(176): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
    #15 /home/public_html/index.php(13): XenForo_FrontController->run()
    #16 {main}
    Request State
    array(3) {
      ["url"] => string(112) "https://www.oursite?net/threads/thread.130044/page-810"
      ["_GET"] => array(0) {
      }
      ["_POST"] => array(0) {
      }
    }
     
Loading...