The behavior you are experiencing is the correct behavior when CODE=rich (cannot tell whether you are using this); this behavior is actually bugged in all versions and it does not always render as expected.
When not using CODE=rich, the problem you are seeing is not limited to the H BB-Code. It will occur with any BB-Code wrapped in CODE/HTML/etc tags, provided it is not the first BB-Code inside the CODE tags. The problem has occurred in all versions since 4.0.0 RC 5, released in November 2014. It can be reproduced with the following simple test:
PHP Code:
[CODE]Testing code block
[b]Unparsed bb-code[/b]
[b]Parsed bb-code[/b][/CODE]
Where (as commented), the first B will display its raw code, but the second B will render as HTML.
In
library/vw/XenForo/BbCode/Parser.php, find:
Code:
if (!$retval)
{
if (empty($this->_parserStates['plainText']))
{
$this->_parserStates['plainText'] = $origPlainTextState;
}
return false;
}
if (empty($this->_parserStates['plainText']))
{
$this->_parserStates['origPlainTextState'][] = $origPlainTextState;
}
Replace with:
Code:
$this->_parserStates['origPlainTextState'][] = $origPlainTextState;
if (!$retval)
{
$this->_parserStates['plainText'] = $origPlainTextState;
return false;
}
Both issues will be fixed in 4.0.26 and 4.1.0 Alpha 3.