Language: PHP
Label: vulnerable
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($errdoc = null, $throw_exception = false)
	{
		if ($errdoc !== null && $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;
					}
				} else {
					// a string (check for ending ")
					// string won't work for lighty
					if (Settings::Get('system.webserver') == 'lighttpd') {
						Response::standardError('stringerrordocumentnotvalidforlighty', '', $throw_exception);
					} elseif (substr($errdoc, -1) != '"') {
						$errdoc .= '"';
					}
				}
			} else {
				if (Settings::Get('system.webserver') == 'lighttpd') {
					Response::standardError('urlerrordocumentnotvalidforlighty', '', $throw_exception);
				}
			}
		}
		return $errdoc;
	}