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

Fixed Error Logging incompatibility with PHP 7

Discussion in 'Resolved Bug Reports' started by Liam W, Jul 23, 2015.

Tags:
  1. Liam W

    Liam W Well-Known Member

    Yes, PHP7 is in Beta, however best to report errors/incompatibilities now rather than wait until it's released :)

    In PHP 7, many fatal errors are now exceptions and extend the Error class.

    This can cause another error to occur, because of XenForo's error-catching and logging systems:

    Code:
    Error Info
    ErrorException: Fatal Error: Uncaught TypeError: Argument 1 passed to XenForo_Application::handleException() must be an instance of Exception, instance of Error given in /Users/liam/xenissuewww/library/XenForo/Application.php:375 Stack trace: #0 [internal function]: XenForo_Application::handleException(Object(Error)) #1 {main} thrown -library/XenForo/Application.php:375
    Generated By: Unknown Account, Tuesday at 7:32 PM
    Stack Trace
    #0 [internal function]: XenForo_Application::handleFatalError()
    #1 {main}
    Request State
    array (size=3)
      'url' => string 'http://xenissue/deferred.php' (length=28)
      '_GET' => 
        array (size=0)
          empty
      '_POST' => 
        array (size=4)
          '_xfRequestUri' => string '/admin.php?template-modifications/' (length=34)
          '_xfNoRedirect' => string '1' (length=1)
          '_xfToken' => string '********' (length=8)
          '_xfResponseType' => string 'json' (length=4)
    
    Liam
     
  2. Mike

    Mike XenForo Developer Staff Member

    I consider not catching errors to roughly be ok. They generally aren't something that should happen in normal use, so ending execution is reasonable. However, the error should be logged correctly, so the general exception handler now doesn't type hint for Exception and allows Exceptions or Throwables, which prevents this issue (in 1.5).
     
    Liam W likes this.

Share This Page