What potential issues can arise when using $_SERVER['REQUEST_URI'] in PHP code?

When using $_SERVER['REQUEST_URI'] in PHP code, potential issues can arise due to security vulnerabilities such as injection attacks. To mitigate this risk, it is important to sanitize and validate the input before using it in your code. One way to do this is by using the filter_input() function with the FILTER_SANITIZE_URL filter to clean the input.

$request_uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL);