Fixed phpbb import: Server Error DateTimeZone

FrankPereiro

Active 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
 
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?
 
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?
 
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.
 
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.
 
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...
 
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?
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.
 
In library/XenForo/Importer/PhpBb31x.php, please replace:
Code:
        $time = new DateTime('now', new DateTimeZone($timeZone));
        $offset = $time->getTimezone()->getOffset($time) / 60 / 60;
        $timeZone = $this->_importModel->resolveTimeZoneOffset($offset, $useDst);
        return $timeZone;
with:
Code:
try
{
   $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?
 
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.
 
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
 
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
 
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?
 
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.
 
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.
 
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
 
Back
Top Bottom