Fix EZP-20251: Unable to run functional tests if legacy stack is involved

Just adds checks before using something in $_SERVER otherwise functional tests always fail