Are there any potential security risks involved in using PHP code within BB Codes in a PHPBB forum?

Using PHP code within BB Codes in a PHPBB forum can pose security risks, as it allows users to execute arbitrary PHP code on the server. To mitigate this risk, it is recommended to disable the execution of PHP code within BB Codes by filtering out any PHP code before rendering the content.

// Disable PHP code execution within BB Codes
$bbcode_content = preg_replace('/\[php\](.*?)\[\/php\]/is', '', $bbcode_content);