Need help fixing a bug...

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]
This is a test page...
  • Bullet Level 1
    • Bullet Level 2

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]
This is a test page...
  • Bullet Level 1
    • Bullet Level 2
      • Bullet Level 3

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?
 
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 ?
the bbcode-plugin has a bug with nested bbcodes.
Here's an quick-and dirty fix:
http://tinymce.moxiecode.com/forum/viewtopic.php?id=14032
- found via Googling: tinyMCE nested bbcode

my theory (without pc access) is that its a php error caused by suexec
source
 
Its got nothing to do with TinyMCE... I can edit the page itself in PhpMyAdmin, the same error occurs.
 
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.
 
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)
 
Top Bottom