I’ve set the header User-Allowed-Tracking to false with the ModHeader Extension and ran my code with x-debug:
const USER_ALLOWED_TRACKING = "HTTP_USER_ALLOWED_TRACKING";
...
public function userAllowedTracking()
{
if (isset($_SERVER[self::USER_ALLOWED_TRACKING])
&& $_SERVER[self::USER_ALLOWED_TRACKING] == true) {
return true;
}
return false;
}
Screenshot:
You can see that the header exist and is indeed set to “false”, so the condition should be false.
If I change it to this, then it works:
public function userAllowedTracking()
{
if (isset($_SERVER[self::USER_ALLOWED_TRACKING])
&& $_SERVER[self::USER_ALLOWED_TRACKING] == "true") {
return true;
}
return false;
}
But why is the condition true in the first code?
