To get around it I've taken out that last 'if' so it always does all 4 $buffer = preg_replace, but I'm not sure if that's a valid fix.
This a smf problem. SMF doesn't work for IIS or apache with php_cgi. So they need to look if all this options are checked ... Probably it's a bug ... I will look forward at tis problem.
Regards