Also, I just noticed this function https://github.com/phpbb/phpbb3/blob/develop/phpBB/includes/functions.php#L1055 which can be used to clean the path if needed.