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 15:40 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 15: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 13:17 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!