Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-8062 now.

color-BBCode doesn't allow 3-digit hex notation [fix provided] (fix completed in vcs)

W3 CSS1 | CSS2.1 wrote:The format of an RGB value in hexadecimal notation is a '#' immediately followed by either three or six hexadecimal characters.

It's a minor flaw but since it's easy to fix, I figured it might be worth mentioning ;)

Open includes/bbcode.php
Find:
Code: Select all
            case 6:
               $this->bbcode_cache[$bbcode_id] = array(
                  'preg' => array(
                     '!\[color=(#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is'   => $this->bbcode_tpl('color', $bbcode_id),
                  )
               );
            break;


Replace with:
Code: Select all
            case 6:
               $this->bbcode_cache[$bbcode_id] = array(
                  'preg' => array(
                     '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is'   => $this->bbcode_tpl('color', $bbcode_id),
                  )
               );
            break;


Open includes/message_parser.php
Find:
Code: Select all
         'color'         => array('bbcode_id' => 6,   'regexp' => array('!\[color=(#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")),


Replace with:
Code: Select all
         'color'         => array('bbcode_id' => 6,   'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")),

Comments / History

Linked ticket with changeset: r9722

Action performed by Anonymous (I am too lazy to register) on Jul 7th 2009, 11:41

Changed ticket status from "New" to "Fix completed in SVN"

Action performed by Acyd Burn (Server Manager) on Jul 7th 2009, 11:44

Ticket details

Related SVN changesets