Ticket #445 (fixed bug)
Can't use [code] string inside a code tag
- Created: 2011-05-24 10:33:44
- Reported by: daris
- Assigned to: FSX
- Milestone: 1.4.6
- Component: parser
- Priority: normal
Try to add a post containing include/parser.php file content inside code tag and you'll see an error (it is not doable)
The following errors need to be corrected before the message can be posted:
There is a problem with your [ code] tags
There is a problem with your [ code] tags
There is a problem with your [ code] tags
Argh! I can't post also this error here as it shows same error (added space before code)
History
taylorchu 2011-05-25 01:06:10

$num_tokens = count($tokens);
for ($i = 1; $i < $num_tokens; ++$i)
{
$temp = explode($end, $tokens[$i]);
if (count($temp) != 2)//here is the problem!
{
$errors[] = $lang_common['BBCode code problem'];
return array(null, array($text));
}
$inside[] = $temp[0];
$outside[] = $temp[1];
}
Reines 2011-06-05 21:32:11

- Status changed from open to fixed.
I think fixed, please can someone do some testing of this, as it totally rewrites for code tags are split.
PS. We really need some unit tests!
daris 2011-06-06 04:49:08

It sometimes ignores code tag:
http://fluxbb.org/forums/viewtopic.php?pid=41228#p41228
Franz 2011-06-11 15:30:22

And another (long) post that breaks the code tags: http://fluxbb.org/forums/viewtopic.php?pid=41477#p41477
Reines 2011-06-12 11:23:57

Ah - this is down to the exceeding pcre.backtrack-limit - as we are using an ungreedy regex. I'll try see what ridgerunner suggests here.
ridgerunner 2011-06-28 15:38:05

As I've said in the past, the basic design of current parser (from 1.3) is less than ideal. There is no simple regex modification that can repair the way CODE is handled.
My new parser allows nested CODE elements - only the outermost element is processed. However, it does not allow an orphaned open or close CODE tag to appear inside the CODE contents.
There is no simple way to unambiguously handle something like:
{code} stuff {code} stuff {/code}
or...
{code} stuff {/code} stuff {/code}

I also need this working so I can correctly make the content of a post of topic email friendly.
This is what I've come up with: http://bit.ly/qvh1fC

Here is some updated code: http://bit.ly/q5q21p
I can't really figure out how the BBcode checker works. That's the part that's now allowing nested code blocks.
Franz 2011-07-31 21:20:36

- Owner changed from Reines to FSX.
Based on IRC talk, you should do that now.