Could uri be a invalid url and then parse_url fail here?