Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-8062

color-BBCode doesn't allow 3-digit hex notation [fix provided]

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 3.0.6
    • 3.0.4
    • Posting
    • None
    • PHP Environment:
      Database:

      W3 CSS1 | CSS2.1:

      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:

      				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:

      				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:

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

      Replace with:

      			'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')")),

            Acyd Burn Meik Sievertsen [X] (Inactive)
            m0rpha m0rpha
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: