Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.4

Bug #3690 BBCodeParser does not allow numbers in the opening tag
Submitted: 2005-03-03 10:40 UTC Modified: 2005-10-18 08:17 UTC
From: sintemaa at hotmail dot com Assigned: quipo
Status: Closed Package: HTML_BBCodeParser
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-03-03 10:40 UTC] sintemaa at hotmail dot com
Description: ------------ BBCodeParser does not allow numbers in the opening tag. I added a new filter in which I added [h1] which should parse to <h1> However it did not parse the opening tag, only the closing tag, which was then properly ignored cause there was no opening tag. When digging into the code of the parser I found that in BBCodeParse.php on line 309 & 319 it uses a regular expression to grab the tags which only looks for a-z(linenumbers according to the cvs.php.net source browser which as a matter of fact messes up the comments in the header of the file, which means I get different linenumbers in my editor) Currently on line 309: if (preg_match("!$oe([a-z]+)[^$ce]*$ce!i", $str, $tagArray) == 0) { Changing it to the following makes it parse tags with numbers aswell: if (preg_match("!$oe([a-z0-9]+)[^$ce]*$ce!i", $str, $tagArray) == 0) { Same fix required for line 319 Reproduce code: --------------- New filter with: var $_definedTags = array( 'h1' => array( 'htmlopen' => 'h1', 'htmlclose' => 'h1', 'allowed' => 'all', 'attributes'=> array()), Use the parser, with the new filter enabled: $parser->qparse('[h1]This is a header[/h1]'); Expected result: ---------------- <h1>this is a header</h1> Actual result: -------------- [h1]this is a header

Comments

 [2005-10-18 08:17 UTC] quipo
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.