In the code section below
if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
Add an inline elseif statement
}elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
Lets take look the original code.
public function getValidatorData()
{
// Some codes here ....
if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
$parts[self::VALIDATOR_HTTP_X_FORVARDED_FOR_KEY] = (string)$_ENV['HTTP_X_FORWARDED_FOR'];
}
// Some codes here ....
return $parts;
}After adding the inline elseif statement section this will be output
public function getValidatorData()
{
// Some codes here ....
if (isset($_ENV['HTTP_X_FORWARDED_FOR'])) {
$parts[self::VALIDATOR_HTTP_X_FORVARDED_FOR_KEY] = (string)$_ENV['HTTP_X_FORWARDED_FOR'];
}elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$parts[self::VALIDATOR_HTTP_X_FORVARDED_FOR_KEY] = (string)$_SERVER['HTTP_X_FORWARDED_FOR'];
}
// Some codes here ....
return $parts;
}NOTE/Disclamer: I don't know why magento developer didn't realize the _ENV global variable, only store data that set by server using setEvn method, and didnt event try to test and get the data in _SERVER global variable. BTW I just saw this bug on magento 1.5.X.