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

Service Issue Register page throwing `DateTimeZone::__construct(): Unknown or bad timezone ()` php errors

Discussion in 'Resolved Bug Reports' started by jeffwidman, Jul 10, 2015.

  1. jeffwidman

    jeffwidman Active Member

    NewRelic is reporting that domain.com/forum/register/register threw 57 of these errors in the last 24 hours:

    DateTimeZone::__construct(): Unknown or bad timezone ()
    There are no entries in the Xenforo server logs.

    If this is still true, I'm guessing it's caused by bots hitting the registration form with messed up timezone info so it throws an error.

    But probably the exception should be caught within the app?
    Last edited: Jul 10, 2015
  2. Mike

    Mike XenForo Developer Staff Member

    You don't have a line number or back trace?

    There is a case where this can happen, but it's explicitly caught, so I'm thinking that the report may be invalid. If XF were generating this, it should be logged by XF.
  3. jeffwidman

    jeffwidman Active Member

    Sorry, forgot to include the stack trace:

    domain.com/public/forum/library/XenForo/DataWriter/User.php (738)
    in XenForo_DataWriter_User::_verifyTimezone called at ? (?)
    domain.com/public/forum/library/XenForo/DataWriter.php (982)
    domain.com/public/forum/library/XenForo/DataWriter.php (725)
    domain.com/public/forum/library/XenForo/DataWriter.php (643)
    domain.com/public/forum/library/XenForo/DataWriter.php (995)
    domain.com/public/forum/library/XenForo/ControllerPublic/Register.php (370)
    domain.com/public/forum/library/XenForo/FrontController.php (347)
    domain.com/public/forum/library/XenForo/FrontController.php (134)
    domain.com/public/forum/index.php (13)
    I'm a bit confused that NewRelic says the error happens at index.php, but when I pull up the list of all the errors, it says the url is /forum/register/register

    Let me know if you want anything else.
  4. Mike

    Mike XenForo Developer Staff Member

    Yes, this is a mis-reported error. We convert PHP warnings into exceptions and the code is:
                new DateTimeZone($timezone);
            catch (Exception $e)
                $this->error(new XenForo_Phrase('please_select_valid_time_zone'), 'timezone');
                return false;
    So the error is always caught; we expect an error to happen there.

    This isn't an error that New Relic should be capturing, though I don't know how their tooling connects to PHP exactly.
    jeffwidman likes this.
  5. jeffwidman

    jeffwidman Active Member

  6. jeffwidman

    jeffwidman Active Member

    Actually, this may be a result of a change they made in a recent release: PHP Agent Release Notes - New Relic Community Forum

  7. Mike

    Mike XenForo Developer Staff Member

    This exception is caught though.
    jeffwidman likes this.

Share This Page