/** Validates values from $_SERVER
* @return string error message or null if valid
*/
function ($name, $value) {
$minLength = isSet($this->minLengths[$name]) ? $this->minLengths[$name] : 0;
$maxLength = isSet($this->maxLengths[$name]) ? $this->maxLengths[$name] : $this->pcre_backtrack_limit;
if ($name == 'SERVER_NAME') {
$errorMessage = $this->($name, $value, $this->serverPatterns['REMOTE_ADDR'], $minLength, $maxLength, 1);
if (!$errorMessage) return null;
return $this->($name, $value, $this->serverPatterns['REMOTE_HOST'], $minLength, $maxLength, 1);
}
if (isSet($this->serverPatterns[$name])) {
$errorMessage = $this->($name, $value, $this->serverPatterns[$name], $minLength, $maxLength, 1);
if ($errorMessage) return $errorMessage;
return isSet($this->maxValues[$name])
? $this->($name, $value)
: null;
}
if (isSet($this->serverCps[$name]))
return $this->($name, $value, $this->($this->serverCps[$name]), $minLength, $maxLength);
if ($name == 'PHP_AUTH_USER' || $name == 'PHP_AUTH_PW' )
return $this->($name, $value);
if (substr($name, 0, 5) == 'HTTP_' || isSet($this->maxLengths[$name]))
return $this->($name, $value, $this->($this->headerValueCp), 0, $maxLength);
//!! remaining values are NOT VALIDATED!
}
|