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

Fixed phpbb import: Server Error DateTimeZone

Discussion in 'Resolved Bug Reports' started by FrankPereiro, Aug 18, 2016.

  1. FrankPereiro

    FrankPereiro Member

    Hi there,

    I'm trying to import my phpbb forum to Xenforum but I get this error when trying to import users:

    Server Error

    DateTimeZone::__construct(): Unknown or bad timezone (0)

    1. DateTimeZone->__construct() in XenForo/Importer/PhpBb31x.php at line 12
    2. XenForo_Importer_PhpBb31x->_resolveTimeZone() in XenForo/Importer/PhpBb3.php at line 896
    3. XenForo_Importer_PhpBb3->_importUser() in XenForo/Importer/PhpBb3.php at line 824
    4. XenForo_Importer_PhpBb3->_importOrMergeUser() in XenForo/Importer/PhpBb3.php at line 613
    5. XenForo_Importer_PhpBb3->stepUsers() in XenForo/Importer/Abstract.php at line 124
    6. XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 189
    7. XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 137
    8. XenForo_ControllerAdmin_Import->actionImport() in XenForo/FrontController.php at line 351
    9. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    10. XenForo_FrontController->run() in /home/frankpereiro/planetabeisbol.com/admin.php at line 13

    Any ideas on how to solve this? Thanks
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Does it fail immediately or after a number of user records have been imported?

    If you are familiar with using phpMyAdmin, can you check what the last record is in the xf_user table in the XF installation.

    The one after that in the phpBB installation should be the one which is failing.
    Can you check what is entered for the time zone in the database for that user?
  3. Mike

    Mike XenForo Developer Staff Member

    It looks like this user has a "0" time zone, so I'm pretty sure that's just storing an offset which is the phpBB 3.0 approach. Can you confirm the specific phpBB version you're running?
  4. FrankPereiro

    FrankPereiro Member

    I'm using the latest phpbb versiĆ³n.

    That error shows up when I'm importing users, don't know who the user is.

    I've just checked the members list on the admin side and I got all the users, but I can't continue the import. When I click on "resume import" it takes me back to the error log. I'm not able to import the contents.
  5. Mike

    Mike XenForo Developer Staff Member

    I'm going to move this to bugs as I think we can handle this better to prevent the error. I'll look at a workaround shortly.
  6. FrankPereiro

    FrankPereiro Member

    Thanks a lot, Mike. I'll stop the transfer until this is solved.

    Tomorrow I'll try a fresh install and do everything all over again.

    Thanks for the support...
  7. Arty

    Arty Well-Known Member

    It happens when installation was imported from phpBB 3.0 to 3.1. Time zones remain in 3.0 format until user updates his profile.
  8. Chris D

    Chris D XenForo Developer Staff Member

  9. Mike

    Mike XenForo Developer Staff Member

    In library/XenForo/Importer/PhpBb31x.php, please replace:
            $time = new DateTime('now', new DateTimeZone($timeZone));
            $offset = $time->getTimezone()->getOffset($time) / 60 / 60;
            $timeZone = $this->_importModel->resolveTimeZoneOffset($offset, $useDst);
            return $timeZone;
       $time = new DateTime('now', new DateTimeZone($timeZone));
       $offset = $time->getTimezone()->getOffset($time) / 60 / 60;
       return $this->_importModel->resolveTimeZoneOffset($offset, $useDst);
    catch (Exception $e)
       return $this->_importModel->resolveTimeZoneOffset($timeZone, $useDst);
    Does that resolve the issue?
  10. FrankPereiro

    FrankPereiro Member

    I'm doing a fresh install since the post count per user is wrong. It says that I have something like 50,000 posts when I really have is something like 5,000.

    So I dumped the database and now I'm uploading the files again, I think it's better to start from scratch.

    I'll let you now if this issue is solved.
  11. FrankPereiro

    FrankPereiro Member

    When I try to go to the importer, I'm getting this error:

    Parse error
    : syntax error, unexpected 'catch' (T_CATCH) in /home/frankpereiro/planetabeisbol.com/library/XenForo/Importer/PhpBb31x.php on line 17
  12. Brogan

    Brogan XenForo Moderator Staff Member

    Are you sure you edited the file correctly?

    Can you paste the relevant lines in code tags?
  13. FrankPereiro

    FrankPereiro Member

    Sorry about my last post, I didn't paste the code as I was told.

    I got the code right this time but I get this:

    Server Error
    Trying to load a non-registered importer.

    1. XenForo_Model_Import->getImporterName() in XenForo/Model/Import.php at line 62
    2. XenForo_Model_Import->getImporterList() in XenForo/ControllerAdmin/Import.php at line 32
    3. XenForo_ControllerAdmin_Import->actionIndex() in XenForo/FrontController.php at line 351
    4. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    5. XenForo_FrontController->run() in /home/frankpereiro/planetabeisbol.com/admin.php at line 13

    I didn't get the option to choose the importer
  14. FrankPereiro

    FrankPereiro Member

    What do you mean by "code tags"?
  15. FrankPereiro

    FrankPereiro Member

    This is weird, wether I try using the file with the code you gave me or the original file, I get the exact same error I brought yesterday.
  16. Chris D

    Chris D XenForo Developer Staff Member

    Have you installed any third party importers?

    If you run a File Health Check from Admin CP > Tools do you get any missing or edited files?
  17. FrankPereiro

    FrankPereiro Member

    No, Chris, I made a fresh install and the only file I've uploaded is the spanish language addon.

    Made a Health File Check and there's an unexpected content. This is with the line of code Mike told me to the replace in my file.
  18. FrankPereiro

    FrankPereiro Member

    I'm going to perform a third fresh install, I'm not even going to upload the spanish language file. Going to start from scratch again.
  19. Chris D

    Chris D XenForo Developer Staff Member

    At the point the error above is happening, it seems to be suggesting that there's an additional file in the Importer directory, or one of the existing files has been edited to have a different title or similar.

    A possible scenario I'm wondering; before adding the code recommended by Mike, did you make a copy of the original file or something as a back up? If you did this, this could actually explain that error.

    Don't worry about backing up the original file; if you need it back you can always get it out of the download package.
  20. FrankPereiro

    FrankPereiro Member

    I made a copy of the original file with the code Mike recomended, the original file I kept in the importer directory, maybe that was my mistake.

    I'll be more careful next time. I already dumped the mysql tables and now I'm deleting all the files, doing a reinstall right now. I'll let you know.

    Thanks, Chris

Share This Page