Language: PHP
Label: safe
CWE: CWE-94 \u2014 Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.

Code:
	private function correctErrorDocument(string $errdoc, $throw_exception = false)
	{
		if (trim($errdoc) != '') {
			// not a URL
			if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:' && strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:') || !Validate::validateUrl($errdoc)) {
				// a file
				if (substr($errdoc, 0, 1) != '"') {
					$errdoc = FileDir::makeCorrectFile($errdoc);
					// apache needs a starting-slash (starting at the domains-docroot)
					if (!substr($errdoc, 0, 1) == '/') {
						$errdoc = '/' . $errdoc;
					}
				} elseif (preg_match('/^"([^\r\n\t\f\0"]+)"$/', $errdoc)) {
					// a string (check for ending ")
					// string won't work for lighty
					if (Settings::Get('system.webserver') == 'lighttpd') {
						Response::standardError('stringerrordocumentnotvalidforlighty', '', $throw_exception);
					}
				} else {
					Response::standardError('invaliderrordocumentvalue', '', $throw_exception);
				}
			} else {
				if (Settings::Get('system.webserver') == 'lighttpd') {
					Response::standardError('urlerrordocumentnotvalidforlighty', '', $throw_exception);
				}
			}
		}
		return trim($errdoc);
	}