The Israel-Hamas war and related boycotts hurt Starbucks’ and McDonald’s sales in the latest quarter.