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

Fixed problems importing from smf over vb

Discussion in 'Resolved Bug Reports' started by principia, May 12, 2011.

  1. principia

    principia Well-Known Member

    i try to import a smf forum over vb to xf.
    the converting to vb has gone, but when i try to import to xf i get an error:

    server_error.png

    while importing thread and posts.

    error details:
    preg_match_all() [<a href='function.preg-match-all'>function.preg-match-all</a>]: Compilation failed: unrecognized character after (?&lt; at offset 17 - library/XenForo/Importer/vBulletin.php:1943

    #0 /home/www/web197/html/forum/library/XenForo/Importer/vBulletin.php(1943): XenForo_Application::handlePhpError('/\
    any tips?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Line 1943 is:

    Code:
    if (preg_match_all('/\[quote=("|\'|)(?<username>[^;]*);\s*(?<postid>\d+)\s*\1\]/siU', $post['pagetext'], $quotes, PREG_SET_ORDER))
    
    I am not a regex guru, but I did some searching and found a possible explanation and a possible fix. I recommend waiting for Mike to respond to this thread before you try anything, but here is what I found:

    1) I found a possible explanation:

    http://www.rockettheme.com/forum/index.php?f=211&t=80945&rb_v=viewtopic

    What version of PHP are you running? Make sure your server meets the requirements by running this test script:

    http://xenforo.com/xenforo-requirements-test.zip

    2) And I found a possible fix (add the P extension to the code):

    http://www.vbprogarage.com/forums/showthread.php/1056-function.preg-match-all-Compilation-failed
    http://www.rockettheme.com/forum/index.php?f=211&t=80945&rb_v=viewtopic

    Edit this file:

    library/XenForo/Importer/vBulletin.php

    Replace this:

    Code:
    if (preg_match_all('/\[quote=("|\'|)(?<username>[^;]*);\s*(?<postid>\d+)\s*\1\]/siU', $post['pagetext'], $quotes, PREG_SET_ORDER))
    
    with this:

    Code:
    if (preg_match_all('/\[quote=("|\'|)(?P<username>[^;]*);\s*(?P<postid>\d+)\s*\1\]/siU', $post['pagetext'], $quotes, PREG_SET_ORDER))
    
    This is untested. Like I said, wait for Mike to respond. He's the regex guy.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Here is all the stuff I found:

    http://www.vbprogarage.com/forums/showthread.php/1056-function.preg-match-all-Compilation-failed

    http://www.rockettheme.com/forum/index.php?f=211&t=80945&rb_v=viewtopic

    http://docs.python.org/library/re.html

     
    laztrix likes this.
  4. principia

    principia Well-Known Member

    thanks very much. i will look at it tomorrow.

    my server is ok with xf and meet the requirements. xf is still running there with no problems.
    only the import doesnt work.

    intersting is, that importing from smf to vb runs without any error. all threads and posts are there.
     
  5. Mike

    Mike XenForo Developer Staff Member

    Jake is likely right - it might be a particular PCRE version. I'll move this to bugs for more investigation.
     
  6. ragtek

    ragtek Guest

    His vB import is strange.

    his imported quotes look like:
    Code:
    [quote author=strwd link=topic=1015.msg44321#msg44321 date=1292790913]
    Gruß[/quote]
    
    instead of the normal vB quote:
    Code:
    [QUOTE=Username;PostId]foo[/quote]
    
    thats why preg_match_all fails and throws an error

    so you would only need to change the preg_match_all pattern and try to run the import
     
  7. principia

    principia Well-Known Member

    Ok, so i must wait more time to convert. :(
     
  8. Vincent

    Vincent Well-Known Member

    Depens on the Devs ;)
    They might be fixing it now :D
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The error is for the regex itself. It's saying the regex is invalid before it even tries to pattern match. That's the problem.
     
  10. ragtek

    ragtek Guest

    But it will still not work, because his smf => vB IMport didn't work correct

    that's his quote
    Code:
    [quote author=strwd link=topic=1015.msg44321#msg44321 date=1292790913]
    
    instead of the normal vb quote.
     
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Well yeah. It won't match the regex so it won't do any replacement. But it shouldn't be generating this error message. The format of his quote tags has nothing to do with the error. He would still get this error if his forum used standard quote tags.
     
  12. Floris

    Floris Guest

    Did you convert SMF over ImpEx to vBulletin 3 or 4 ?
    I always use 3, and SMF hasn't given me these issues yet.

    Upon convert from SMF to vB to fix the quote stuff, you could use Kier his 'find/replace' plugin to make it 'vBulletin friendly'.
     
  13. principia

    principia Well-Known Member

    Yes, Im using VB3.8 and Impex.
     
  14. principia

    principia Well-Known Member

    I have testet the fix from Jake (post #3) and -
    IT works!!!!!! [​IMG] Yippi.

    So some things to do and i will convert to XF on Saturday next week.

    Thanks to all helpful hands.
    Thread can be closed.
     
    Vincent likes this.
  15. Mike

    Mike XenForo Developer Staff Member

    Fixed with the "P" addition.
     

Share This Page