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

Fixed Nested quotes import problem

Discussion in 'Resolved Bug Reports' started by imthebest, Mar 6, 2014.

  1. imthebest

    imthebest Formerly Super120

    I'm migrating from vB 3.8. One of my posts contains this:

    Code:
    [quote=user1][quote=user2;3142018]what user2 said[/quote]
    what user1 said[/quote]
    But xenForo is importing the nested quotes bad:

    Code:
    [quote="user1][quote=user2, post: 3142018"]what user2 said[/quote]
    what user1 said[/quote]
    Is this a bug?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    If you are talking about the change to the inner quote; no. It converted it to XenForo's format.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    @Super120

    I am seeing a possible bug here.

    library/XenForo/Importer/vBulletin.php

    Code:
    					if (stripos($post['pagetext'], '[quote=') !== false)
    					{
    						if (preg_match_all('/\[quote=("|\'|)(?P<username>[^;]*);\s*(?P<postid>\d+)\s*\1\]/siU', $post['pagetext'], $quotes, PREG_SET_ORDER))
    						{
    							$post['quotes'] = array();
    
    							foreach ($quotes AS $quote)
    							{
    								$quotedPostId = intval($quote['postid']);
    
    								$quotedPostIds[] = $quotedPostId;
    
    								$post['quotes'][$quote[0]] = array($quote['username'], $quotedPostId);
    							}
    						}
    					}
    
    This piece specifically:

    Code:
    (?P<username>[^;]*)
    
    Try changing it to this:

    Code:
    (?P<username>[^;\]]*)
    
    The original code is bounds-matching the name with a semicolon only which would overrun in your example. The new code adds a right bracket to the bound so it can't escape from the first quote tag.

    Moving to bugs for dev review. In the meantime please try that fix and re-run the import. Let me know if it works.
     
    imthebest likes this.
  4. imthebest

    imthebest Formerly Super120

    Well in fact I was using the cli importer but I'll test and let you know.
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The one stored at library/XFCliImporter? That importer has the same piece of code.
     
  6. Mike

    Mike XenForo Developer Staff Member

    The fix seems reasonable -- it's certainly safer in that it's less likely to "over write", but has the potential to not rewrite something it potentially should.
     
    imthebest likes this.

Share This Page