Can you also try:
if(isset($_SERVER['HTTPS'])) { $fullUrl .= 's'; }
Which I think should give identical results.
Can you also try:
{
}
Which I think should give identical results.