core-bundle/src/Resources/contao/library/Contao/Validator.php
public static function isInsecurePath($strPath)
	{
		// Normalize backslashes
		$strPath = strtr($strPath, '\\', '/');
		$strPath = preg_replace('#//+#', '/', $strPath);

		// Equals ..
		if ($strPath == '..')
		{
			return true;
		}

		// Begins with ./
		if (substr($strPath, 0, 2) == './')
		{
			return true;
		}

		// Begins with ../
		if (substr($strPath, 0, 3) == '../')
		{
			return true;
		}

		// Ends with /.
		if (substr($strPath, -2) == '/.')
		{
			return true;
		}

		// Ends with /..
		if (substr($strPath, -3) == '/..')
		{
			return true;
		}

		// Contains /../
		if (strpos($strPath, '/../') !== false)
		{
			return true;
		}

		return false;
	}
public static function isInsecurePath($strPath)
	{
		// Normalize backslashes
		$strPath = strtr($strPath, '\\', '/');
		$strPath = preg_replace('#//+#', '/', $strPath);

		// Equals ..
		if ($strPath == '..')
		{
			return true;
		}

		// Begins with ./
		if (substr($strPath, 0, 2) == './')
		{
			return true;
		}

		// Begins with ../
		if (substr($strPath, 0, 3) == '../')
		{
			return true;
		}

		// Ends with /.
		if (substr($strPath, -2) == '/.')
		{
			return true;
		}

		// Ends with /..
		if (substr($strPath, -3) == '/..')
		{
			return true;
		}

		// Contains /../
		if (strpos($strPath, '/../') !== false)
		{
			return true;
		}

		return false;
	}
public static function isInsecurePath ( $ strPath ) { // Normalize backslashes $ strPath = strtr ( $ strPath , '\\' , '/' ) ; $ strPath = preg_replace ( '#//+#' , '/' , $ strPath ) ; // Equals .. if ( $ strPath == '..' ) { return true ; } // Begins with ./ if ( substr ( $ strPath , 0 , 2 ) == './' ) { return true ; } // Begins with ../ if ( substr ( $ strPath , 0 , 3 ) == '../' ) { return true ; } // Ends with /. if ( substr ( $ strPath , - 2 ) == '/.' ) { return true ; } // Ends with /.. if ( substr ( $ strPath , - 3 ) == '/..' ) { return true ; } // Contains /../ if ( strpos ( $ strPath , '/../' ) !== false ) { return true ; } return false ; }
Insecure path potentially containing directory traversal

@param string $strPath The file path

@return boolean True if the file path is insecure
Insecure path potentially containing directory traversal