Not Solved phpBB3 > MyBB Merge Fatal Error: Uncaught exception
#1
Not Solved
I tried to merge a phpBB3 system to MyBB 1.8.5. I didn't see anything in the docs about downloading or uploading the old database. However, when I filled out the Database Configuration, I got the message that the merge system had connected with the database. I assume it found it on the server and no upload was necessary.

With the Database Config completed and the Usergroups completed, I ran Users. The following error was generated and no users were imported:

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() [<a href='datetimezone.--construct'>datetimezone.--construct</a>]: Unknown or bad timezone ()' in C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\functions.php:1014 Stack trace: #0 C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\functions.php(1014): DateTimeZone->__construct('') #1 C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\boards\phpbb3\users.php(128): get_timezone('') #2 C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\modules\users.php(182): PHPBB3_Converter_Module_Users->convert_data(Array) #3 C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\boards\phpbb3\users.php(45): Converter_Module_Users->insert(Array) #4 C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\index.php(946): PHPBB3_Converter_Module_Users->import() #5 {main} thrown in C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\functions.php on line 1014

Lane
Reply
#2
Not Solved
Odd, medert saw that before. A simple try/catch should do it. Could you send me your phpbb database so I can check what exactly causes the error? (Will push the fix tomorrow)
Support PMs will be ignored!
Reply
#3
Not Solved
(2015-06-19, 06:21 PM)Jones H Wrote: Odd, medert saw that before. A simple try/catch should do it. Could you send me your phpbb database so I can check what exactly causes the error? (Will push the fix tomorrow)

Thanks for the reply. I've uploaded the zip to my server and this link should get it for you.

Lane
Reply
#4
Not Solved
Thanks, downloaded it. I've removed the link as I doubt you want everybody to get your database Wink I'll take a look tomorrow and fix the issue.
Support PMs will be ignored!
Reply
#5
Not Solved
Though I haven't seen an error I've pushed the try/catch thing: https://github.com/mybb/merge-system/com...f81000b3f6

However note that you need to set SKIP_ENCODING_DETECTION to "1" in index.php and that you'll see some other issues as your database contains some old values which aren't considered (eg most accounts were unapproved or your forums didn't have a parent category).
Support PMs will be ignored!
Reply
#6
Not Solved
Thanks for the suggestions. I thought I was supposed to get an email notification of replies, but I didn't, so that's why I'm just now getting back to you. I'll make the changes in index.php and functions.php and see how it goes.

Later: Well, poo. I got this error when I ran merge:
Quote:Parse error: syntax error, unexpected $end in C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\functions.php on line 1046
The last function in functions.php reads:

 // Converts a String timezone (Europe/Berlin) to a MyBB number
 function get_timezone($zone)
 {
  try {
   $time = new DateTime('now', new DateTimeZone($zone));
   $off = $time->format('P');
  }
  catch(Exception $e) {
   return '';
  }
  
  list($h, $m) = explode(":", $off);
  
  list($h, $m) = explode(":", $off);

  $v = substr($h, 0, 1);
  $h = substr($h, 1);

  if(substr($h, 0, 1) == 0)
   $h = substr($h, 1);

  if($m == 30)
   $h .= ".5";
  else if($m == 45)
   $h .= ".75";

  if($v == "-")
   $h = "-{$h}";

  return $h;
}

The last line above is 1045, and line 1046 is the last line in the file and just has: ?>

Lane
Reply
#7
Not Solved
^ try { in above code segment is a mistake (should be removed)
Reply
#8
Not Solved
(2015-06-22, 03:29 PM).m. Wrote: ^ try { in above code segment is a mistake (should be removed)

I assumed if I took out the above I should also take out the "}"  three lines down. When I ran merge, I got this:

Quote:Parse error: syntax error, unexpected T_CATCH in C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\functions.php on line 1020
Line 1020 is the catch line.

Lane
Reply
#9
Not Solved
^ removed end brace (}) needs to be added back !
Reply
#10
Not Solved
(2015-06-22, 03:58 PM).m. Wrote: ^ removed end brace (}) needs to be added back !

OK, now I get the same error:

Quote:Parse error: syntax error, unexpected T_CATCH in C:\HostingSpaces\crsq\creationresearch.org\wwwroot\MyBB\merge\resources\functions.php on line 1020

To be sure we're communicating, this is now the end of the functions.php:

// Converts a String timezone (Europe/Berlin) to a MyBB number
 function get_timezone($zone)
 {
$time = new DateTime('now', new DateTimeZone($zone));
$off = $time->format('P');
} catch(Exception $e) {
return '';
}
  
  list($h, $m) = explode(":", $off);
  
list($h, $m) = explode(":", $off);

$v = substr($h, 0, 1);
$h = substr($h, 1);

if(substr($h, 0, 1) == 0)
   $h = substr($h, 1);

if($m == 30)
   $h .= ".5";
else if($m == 45)
   $h .= ".75";

if($v == "-")
   $h = "-{$h}";

return $h;
}
?>
Lane
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)