theyak / nbbc

nbbc
Other
3 stars 12 forks source link

endtag BBCODE_REQUIRED ignored #2

Open Weilhart opened 9 years ago

Weilhart commented 9 years ago

All endtags seem to be obeying BBCODE_OPTIONAL no matter what. You can see the problem by parsing:

[img]some_image_url

without the [/img] endtag, which should be required. The image tag will be generated regardless. Seems to affect all tags.

theyak commented 9 years ago

This is confirmed, however, this comment appears in the code:

            // This is a start tag that is either ending-optional or ending-forgotten.
            // But because of class dependencies, we can't simply reject it; deeper
            // tags may already have been processed on the assumption that this class
            // was valid.  So rather than reject it, as one might expect from
            // 'end_tag' => BBCODE_REQUIRED, we process it so that any deeper tags
            // that require it will still be treated correctly.  This is the only
            // alternative to having to perform two passes over the input, one to validate
            // classes and the other to convert the output:  So we choose speed over
            // precision here, but it's a decision that only affects broken tags anyway.

This just makes me wonder what the point of BBCODE_REQUIRED is, since it doesn't seem to do anything.

Unfortunately, the author of this library seems to have abandoned the project in 2010.