milesj / decoda

A lightweight lexical string parser for BBCode styled markup.
MIT License
196 stars 52 forks source link

Function strip() return the content two times when used after parse(). #108

Closed noemi-salaun closed 8 years ago

noemi-salaun commented 8 years ago

When $decoda->strip() is used after $decoda->parse(), it returns the content two times.

An example that works

$decoda = new \Decoda\Decoda('[b]Something[/b]');
$decoda->defaults();
echo $decoda->strip();

The above example will output:

Something

An example that does not work

$decoda = new \Decoda\Decoda('[b]Something[/b]');
$decoda->defaults();
echo $decoda->parse() . "\n";
echo $decoda->strip();

The above example will output:

<b>Something</b>
SomethingSomething
milesj commented 8 years ago

This is correct. Both parse() and strip() are different methods doing different things, so echoing both of them will produce 2 outputs.

noemi-salaun commented 8 years ago

But in the second example, echo parse() output <b>Something</b> and echo strip() output SomethingSomething.

strip() should echo only one Something.

milesj commented 8 years ago

Oh sorry, didn't notice double Something. After briefly looking at the code, I don't see how that would occur, but would have to dig a bit deeper.

milesj commented 8 years ago

This has been fixed.