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

Fixed DateTime::__construct(): Failed to parse time string

Discussion in 'Resolved Bug Reports' started by Andy.N, Dec 23, 2011.

  1. Andy.N

    Andy.N Well-Known Member

    I have many members imported from VB 3.8 whose DOB fields are out of order (such as year is 3453 and month is 45).
    When I go directly to that member's profile page, it will show a server error message (and generates a record ACP as well).

    Here is what shows on the member profile page
    Server Error
    DateTime::__construct(): Failed to parse time string (1116-19-82) at position 6 (9): Unexpected character
    1. DateTime->__construct() in XenForo/Model/UserProfile.php at line 27
    2. XenForo_Model_UserProfile->getUserBirthdayDetails() in XenForo/ControllerPublic/Member.php at line 227
    3. XenForo_ControllerPublic_Member->actionMember() in Bookmarks/ControllerPublic/Member.php at line 18
    4. Bookmarks_ControllerPublic_Member->actionMember() in XenForo/FrontController.php at line 310
    5. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  2. Mike

    Mike XenForo Developer Staff Member

    I've fixed this at the importer stage. This query will fix broken dates:
    UPDATE xf_user_profile SET dob_day = 0, dob_month = 0, dob_year = 0 WHERE dob_day > 31 OR dob_month > 12 OR dob_year > 2012 OR (dob_year > 0 AND dob_year < 1900);

Share This Page