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

Need help fixing a bug...

Discussion in 'XenForo Development Discussions' started by Jaxel, Jan 10, 2011.

  1. Jaxel

    Jaxel Well-Known Member

    This bug is in my XenCarta Wiki mod... does not happen in the forums.

    If I make a page with this, it loads perfectly fine...
    Code:
    This is a test page...
    [LIST][*]Bullet Level 1
    [LIST][*]Bullet Level 2
    [/LIST]
    [/LIST]
    However, if I make a page with this, it breaks...
    Code:
    This is a test page...
    [LIST][*]Bullet Level 1
    [LIST][*]Bullet Level 2
    [LIST][*]Bullet Level 3
    [/LIST]
    [/LIST]
    [/LIST]
    Creating anything more than 2 levels of bullets gives me an error:
    Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

    Anyone know what this means? And how it happens?
     
  2. Cory Booth

    Cory Booth Well-Known Member

  3. Jaxel

    Jaxel Well-Known Member

  4. Digital Doctor

    Digital Doctor Well-Known Member

    Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

    - this is a very generic error ! It is more common in Chrome it seems.

    Q: Have you tried inserting it via the Text only Editor ?

    Might this help ?
    http://tinymce.moxiecode.com/forum/viewtopic.php?id=14032
    - found via Googling: tinyMCE nested bbcode

    source
     
  5. Digital Doctor

    Digital Doctor Well-Known Member

  6. Jaxel

    Jaxel Well-Known Member

    Its got nothing to do with TinyMCE... I can edit the page itself in PhpMyAdmin, the same error occurs.
     
  7. Jaxel

    Jaxel Well-Known Member

    Okay... I narrowed it down to my 3 parsers (autolinks, table of contents and templates). So I disabled all 3, and started rebuilding them one by one. I recreated this parser one by one...

    Code:
    	public function parseAutolinks($page)
    	{
    		$options = XenForo_Application::get('options');
    
    		if ($options->EWRcarta_autolink && !empty($page['page_name']))
    		{
    			$pages = $this->_getDb()->fetchAll("
    				SELECT *
    					FROM EWRcarta_pages
    				WHERE page_name != ?
    				ORDER BY LENGTH(page_name) DESC
    			", $page['page_name']);
    
    			foreach ($pages AS $link)
    			{
    				$noMatch = '(</a>|</h\d+>)';
    
    				$linkUrl = XenForo_Link::buildPublicLink('wiki', $link);
    				$linkPin = '#(?!(?:[^<]+>|[^>]+'.$noMatch.'))\b'.preg_quote($link['page_name']).'\b#i';
    				$linkRpl = '<a href="'.$linkUrl.'">'.$link['page_name'].'</a>';
    
    				$page['HTML'] = preg_replace($linkPin, $linkRpl, $page['HTML'], $options->EWRcarta_autolink);
    			}
    		}
    
    		return $page;
    	}
    The moment I added the following line, it broke:
    Code:
    $page['HTML'] = preg_replace($linkPin, $linkRpl, $page['HTML'], $options->EWRcarta_autolink);
    So I figured, maybe there was a replacement problem... so I replaced it with this:
    Code:
    $test['HTML'] = 'blah blah blank text blah blah';
    $test['HTML'] = preg_replace($linkPin, $linkRpl, $test['HTML'], $options->EWRcarta_autolink);
    Yet it still broke... even though I'm not touching any real content.
     
  8. Jaxel

    Jaxel Well-Known Member

    Okay... upon further testing, I've narrowed this down... this is in my ViewPublic:
    Code:
    if ($this->_params['input']['page_type'] == 'bbcode')
    {
    	$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
    	$this->_params['input']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['input']['page_content'], $bbCodeParser);
    }
    else
    {
    	$this->_params['input']['HTML'] = $this->_params['input']['page_content'];
    }
    
    $count = preg_match_all('#<h\d+>#i', $this->_params['input']['HTML'], $headMatches);
    The last line of code is essential for something else I'm doing, lets not get into what I'm using it for, but just know that I've removed all code of it and now that is all that remains; I did this for testing purposes to find the exact line that causes issues.

    If I remove that last line of code, the page renders fine. Why does that line of code break high level bullets? (and my [medio] tag for that matter)
     

Share This Page