Answer
If a fasting person vomits phlegm, it does not invalidate their fast at all, whether it comes down from the head or up from the stomach, and whether it is a little or a lot; because phlegm, due to its viscous nature, does not mix with impurities, and it is not impure in itself, as mentioned in Sharh al-Wiqayah 1: 87, and al-Sa'ayah 1: 220.