If a user inadvertently doesn't close the [code] tag properly, by omitting the /, as in the following example
[code] some code here [code]
Parsing fails with the following error
PHP Warning: At: class/nbbc.php (Line: 1402) array_pop() [function.array-pop]: The argument should be an array
Other tags work as expected, only the code tag appears to suffer this behaviour.
I've worked around it for now, by adding the following line before the array_pop()
if (!empty($this->start_tags[$name]) && is_array($this->start_tags[$name]))
but it's not really a fix, more a way of allowing the user to correct the mistake, the actual output produced by the workaround leaves a lot to be desired :/
Hmm. That sounds very possible, and under no circumstances should NBBC ever produce PHP errors, so I've upgraded this to 'high' priority.. I'll have to investigate it this week when I can get some time to do so.
Thank you very much. This bug aside, NBBC is the best BBCode parser I've come across by far, your efforts are much appreciated.
In the 1.4.4 release of NBBC, verbatim parsing was changed, and that changed how this bug works. It's now no longer a substantial error like it was, but it's still slightly wrong.
As of the 1.4.5 release, if this is the provided input:
[code]some code here[/code]
NBBC will produce this as its HTML output:
some code here[/code][code]some code here[/code]
It's not quite right, it's but much better than crashing, so I've downgraded this to a low-priority bug.
Related
Code: code