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

Bug #16219 [size=9] Doesn't work (int > 9 does)
Submitted: 2009-05-12 01:53 UTC
From: dmagnetic Assigned:
Status: Open Package: HTML_BBCodeParser (version 1.2.2)
PHP Version: 5.2.9 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2009-05-12 01:53 UTC] dmagnetic (Drew Mclure)
Description: ------------ [size=9]Some size 9 text[/size] Produces <span>Some size 9 text</span> So no font-size is being applied. As soon as the font-size is 10+ it works fine.

Comments

 [2009-05-23 23:09 UTC] doconnor (Daniel O'Connor)
Hey Drew, are you able to add in a small executable example?
 [2012-09-16 19:07 UTC] hdc (Anatoly Vdovichev)
I confirm, [size=9] does not work. Problem is in regex of splitting tag string to attributes - it requires at least two characters for unquoted attributes (except url tag). Idea of fix - to change way of forming list of not allowed charaters of tag attributes. Also, it is ok to use '=' sign for attribute of img tag. --- BBCodeParser.php.orig 2012-09-14 04:17:33.000000000 +0700 +++ BBCodeParser.php 2012-09-16 21:01:11.000000000 +0700 @@ -456,11 +456,11 @@ // tnx to Onno for the regex // validate the arguments $attributeArray = array(); - $regex = "![\s$oe]([a-z0-9]+)=(\"[^\s$ce]+\"|[^\s$ce]"; - if ($tag['tag'] != 'url') { - $regex .= "[^=]"; + $regex = "![\s$oe]([a-z0-9]+)=(\"[^\s$ce]+\"|[^\s$ce"; + if (($tag['tag'] != 'url') && ($tag['tag'] != 'img')) { + $regex .= "="; } - $regex .= "+)(?=[\s$ce])!i"; + $regex .= "]+)(?=[\s$ce])!i"; preg_match_all($regex, $str, $attributeArray, PREG_SET_ORDER); foreach ($attributeArray as $attribute) { $attNam = strtolower($attribute[1]);