In XenForo_BbCode_Parser::_parseTagOpen there is:
I'm fairly sure that the call preg_match isn't required as _getTagRule will do a fast isset lookup into the taglist, This tag list has already been verified that the tag names match that pattern anyway.
In XenForo_BbCode_Parser::_parseTagClose:
If this isn't a valid tag, then it can't be considered to be a closing tag. So that preg_match could be replaced with a call to _getTagRule.
IMO the length check could be pushed into _getTagRule (and adding a check that the tag name isn't longer than 25 character) before the strtolower call is even done.
Code:
if (strlen($tagName) == 0 || preg_match('/[^a-z0-9_-]/i', $tagName) || !$this->_getTagRule($tagName))
{
return false;
}
I'm fairly sure that the call preg_match isn't required as _getTagRule will do a fast isset lookup into the taglist, This tag list has already been verified that the tag names match that pattern anyway.
In XenForo_BbCode_Parser::_parseTagClose:
Code:
if (strlen($tagName) == 0 || preg_match('/[^a-z0-9_-]/i', $tagName))
IMO the length check could be pushed into _getTagRule (and adding a check that the tag name isn't longer than 25 character) before the strtolower call is even done.
Last edited: